From 15f4381cf54901895836551a30f66c0cee974a0c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 23 Jan 2017 20:42:02 +0000 Subject: Move target URI handling out of zipfile module --- lib/docx/uris.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/docx/uris.js (limited to 'lib/docx/uris.js') diff --git a/lib/docx/uris.js b/lib/docx/uris.js new file mode 100644 index 0000000..0179e5b --- /dev/null +++ b/lib/docx/uris.js @@ -0,0 +1,11 @@ +exports.uriToZipEntryName = uriToZipEntryName; + +function uriToZipEntryName(base, uri) { + if (uri.charAt(0) === "/") { + return uri.substr(1); + } else { + // In general, we should check first and second for trailing and leading slashes, + // but in our specific case this seems to be sufficient + return base + "/" + uri; + } +} -- cgit v1.2.3