Remove extension testing in replace_pic()

This commit is contained in:
Eric Lapouyade 2020-08-23 18:22:25 +02:00
parent 74d46579be
commit 3b4de31734
2 changed files with 5 additions and 7 deletions

View File

@ -1,3 +1,7 @@
0.10.1 (2020-05-25)
-------------------
- Remove extension testing (#297)
0.10.0 (2020-05-25)
-------------------
- Fix spaces missing in some cases (#116, #227)

View File

@ -7,7 +7,7 @@ Created : 2015-03-12
import functools
import io
__version__ = '0.10.0'
__version__ = '0.10.1'
from lxml import etree
from docx import Document
@ -446,12 +446,6 @@ class DocxTemplate(object):
# NOTE: file extension not checked
self.pic_to_replace[embedded_file] = dst_file.read()
else:
emp_path, emb_ext = os.path.splitext(embedded_file)
dst_path, dst_ext = os.path.splitext(dst_file)
if emb_ext != dst_ext:
raise ValueError('replace_pic: extensions must match')
with open(dst_file, 'rb') as fh:
self.pic_to_replace[embedded_file] = fh.read()