diff --git a/src/rethink/models/files/unzip.py b/src/rethink/models/files/unzip.py index 7f6f506..b52cd6d 100644 --- a/src/rethink/models/files/unzip.py +++ b/src/rethink/models/files/unzip.py @@ -1,5 +1,4 @@ import io -import os.path import zipfile from typing import Dict @@ -13,11 +12,11 @@ def unzip_file(zip_bytes: bytes) -> Dict[str, bytes]: _filepath = filepath.encode('cp437').decode('utf-8') except UnicodeEncodeError: _filepath = filepath - sp = _filepath.split(os.path.sep) + sp = _filepath.split("/") if sp[0] in ["__MACOSX", ".DS_Store"]: continue if len(sp) > 1: - _filepath = os.path.sep.join(sp[1:]) + _filepath = "/".join(sp[1:]) if _filepath.strip() == "" or _filepath.startswith("."): continue extracted_files[_filepath] = ref.read(filepath) diff --git a/tests/test_models_files_unzip.py b/tests/test_models_files_unzip.py index b7b69c7..7f47a84 100644 --- a/tests/test_models_files_unzip.py +++ b/tests/test_models_files_unzip.py @@ -29,7 +29,10 @@ def test_unzip_folder(self): with open("test.zip", "rb") as f: extracted_files = unzip.unzip_file(f.read()) for filename, content in extracted_files.items(): - self.assertEqual(self.orig_folder_data[os.path.join("a", filename)], content) + self.assertEqual( + self.orig_folder_data[os.path.join("a", filename)], + content, + msg=str(self.orig_folder_data)) os.remove("test.zip") def test_unzip_files(self):