Fix img handling on subdirs

Reviewed-by: Kucerak, Kristian <kristian.kucerak@t-systems.com>
Co-authored-by: gtema <artem.goncharov@gmail.com>
Co-committed-by: gtema <artem.goncharov@gmail.com>
This commit is contained in:
gtema 2022-10-11 14:56:55 +00:00 committed by zuul
parent 62b5636b2d
commit 035322711f

View File

@ -139,7 +139,10 @@ class OTCDocConvertor:
if img:
# Store all referred images for copying
self.doc_images.add(img["src"])
img["src"] = "/_static/images/" + img["src"]
img["src"] = (
"/_static/images/"
+ os.path.basename(img["src"])
)
del img["width"]
del img["height"]
del img["class"]
@ -165,7 +168,7 @@ class OTCDocConvertor:
for img in soup.body.find_all("img"):
if img["src"] and not img["src"].startswith("/_static/images"):
self.doc_images.add(img["src"])
img["src"] = "/_static/images/" + img["src"]
img["src"] = "/_static/images/" + os.path.basename(img["src"])
del img["width"]
del img["height"]
del img["class"]