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/docx/body_xml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mammoth/docx') diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index 1fcd567..433d5a2 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -3,6 +3,7 @@ import contextlib from .. import documents from .. import results from .. import lists +from ..zips import uri_to_zip_entry_name from .xmlparser import node_types, XmlElement from .styles_xml import Styles @@ -317,7 +318,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f return _find_linked_image(link_relationship_id) def _find_embedded_image(relationship_id): - image_path = "word/" + relationships[relationship_id].target.lstrip("/") + image_path = uri_to_zip_entry_name("word", relationships[relationship_id].target) def open_image(): image_file = docx_file.open(image_path) -- cgit v1.2.3