From de55a714711a27207367bc8c5c8370549a9bd219 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 23 Jan 2017 20:17:18 +0000 Subject: Handle target URIs relative to the base --- mammoth/zips.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mammoth/zips.py') 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 -- cgit v1.2.3