diff --git a/rocrate/rocrate.py b/rocrate/rocrate.py
index 5c3969d..a968f10 100644
--- a/rocrate/rocrate.py
+++ b/rocrate/rocrate.py
@@ -510,6 +510,8 @@ class ROCrate():
                 root = Path(root)
                 for name in files:
                     source = root / name
+                    if source.samefile(out_file_path):
+                        continue
                     dest = source.relative_to(top)
                     if not self.dereference(str(dest)):
                         zf.write(str(source), str(dest))

diff --git a/test/test_write.py b/test/test_write.py
index 63fdc85..c83797c 100644
--- a/test/test_write.py
+++ b/test/test_write.py
@@ -215,3 +215,17 @@ def test_no_parts(tmpdir, helpers):
     json_entities = helpers.read_json_entities(out_path)
     helpers.check_crate(json_entities)
     assert "hasPart" not in json_entities["./"]
+
+
+def test_no_zip_in_zip(test_data_dir, tmpdir):
+    crate_dir = test_data_dir / 'ro-crate-galaxy-sortchangecase'
+    crate = ROCrate(crate_dir)
+
+    zip_name = 'ro_crate_out.crate.zip'
+    zip_path = crate_dir / zip_name  # within the crate dir
+    crate.write_zip(zip_path)
+    out_path = tmpdir / 'ro_crate_out'
+    with zipfile.ZipFile(zip_path, "r") as zf:
+        zf.extractall(out_path)
+
+    assert not (out_path / zip_name).exists()

write_zip should not include the new archive in itself
If one calls `write_zip` with an output path that is within the RO-crate directory, the new zip file ends up inside itself.  As `write_zip` walks the directory tree it'll find the partially written zip file and copy it into the archive.
test/test_write.py::test_no_zip_in_zip
test/test_write.py::test_file_writing[False-False] test/test_write.py::test_file_writing[False-True] test/test_write.py::test_file_writing[True-False] test/test_write.py::test_file_writing[True-True] test/test_write.py::test_file_stringio test/test_write.py::test_remote_uri[False] test/test_write.py::test_remote_uri[True] test/test_write.py::test_remote_uri_exceptions test/test_write.py::test_missing_source[False-False] test/test_write.py::test_missing_source[False-True] test/test_write.py::test_missing_source[True-False] test/test_write.py::test_missing_source[True-True] test/test_write.py::test_stringio_no_dest[False-False] test/test_write.py::test_stringio_no_dest[False-True] test/test_write.py::test_stringio_no_dest[True-False] test/test_write.py::test_stringio_no_dest[True-True] test/test_write.py::test_no_source_no_dest[False-False] test/test_write.py::test_no_source_no_dest[False-True] test/test_write.py::test_no_source_no_dest[True-False] test/test_write.py::test_no_source_no_dest[True-True] test/test_write.py::test_dataset test/test_write.py::test_no_parts