diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-01-23 20:17:18 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-01-23 20:17:34 +0000 |
| commit | de55a714711a27207367bc8c5c8370549a9bd219 (patch) | |
| tree | 61765502ea99e740c2a6d1f7ab1391794e5f0e9d /mammoth/zips.py | |
| parent | cd52af70959fa7a549f2283a36408e5144c19112 (diff) | |
Handle target URIs relative to the base
Diffstat (limited to 'mammoth/zips.py')
| -rw-r--r-- | mammoth/zips.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mammoth/zips.py b/mammoth/zips.py index 432be5d..8e09924 100644 --- a/mammoth/zips.py +++ b/mammoth/zips.py @@ -54,3 +54,10 @@ def update_zip(fileobj, files): fileobj.seek(0) destination_fileobj.seek(0) shutil.copyfileobj(destination_fileobj, fileobj) + + +def uri_to_zip_entry_name(base, uri): + if uri.startswith("/"): + return uri[1:] + else: + return base + "/" + uri |
