| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3209,6 +3209,17 @@ def test_inheritance(self, alpharep): | |||
| 3209 | 3209 | file = cls(alpharep).joinpath('some dir').parent | |
| 3210 | 3210 | assert isinstance(file, cls) | |
| 3211 | 3211 | ||
| 3212 | + @pass_alpharep | ||
| 3213 | + def test_extract_orig_with_implied_dirs(self, alpharep): | ||
| 3214 | + """ | ||
| 3215 | + A zip file wrapped in a Path should extract even with implied dirs. | ||
| 3216 | + """ | ||
| 3217 | + source_path = self.zipfile_ondisk(alpharep) | ||
| 3218 | + zf = zipfile.ZipFile(source_path) | ||
| 3219 | + # wrap the zipfile for its side effect | ||
| 3220 | + zipfile.Path(zf) | ||
| 3221 | + zf.extractall(source_path.parent) | ||
| 3222 | + | ||
| 3212 | 3223 | ||
| 3213 | 3224 | if __name__ == "__main__": | |
| 3214 | 3225 | unittest.main() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2197,6 +2197,17 @@ def resolve_dir(self, name): | |||
| 2197 | 2197 | dir_match = name not in names and dirname in names | |
| 2198 | 2198 | return dirname if dir_match else name | |
| 2199 | 2199 | ||
| 2200 | + def getinfo(self, name): | ||
| 2201 | + """ | ||
| 2202 | + Supplement getinfo for implied dirs. | ||
| 2203 | + """ | ||
| 2204 | + try: | ||
| 2205 | + return super().getinfo(name) | ||
| 2206 | + except KeyError: | ||
| 2207 | + if not name.endswith('/') or name not in self._name_set(): | ||
| 2208 | + raise | ||
| 2209 | + return ZipInfo(filename=name) | ||
| 2210 | + | ||
| 2200 | 2211 | @classmethod | |
| 2201 | 2212 | def make(cls, source): | |
| 2202 | 2213 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + In zipfile, apply | ||
| 2 | + fix for extractall on the underlying zipfile after being wrapped in | ||
| 3 | + ``Path``. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments