Skip to content

Commit

Permalink
Merge pull request #186 from codeEmpress1/fix-image-parsing
Browse files Browse the repository at this point in the history
update image parsing
  • Loading branch information
codeEmpress1 authored Jan 17, 2024
2 parents 505415c + 7df314b commit 948374a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions canonicalwebteam/discourse/parsers/base_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ def _replace_image_src(self, soup):
Given some HTML soup, replace relative image srcs
"""
for img in soup.findAll("img"):
src = img.get("src", "")
if src and src.startswith("/") and not src.startswith("//"):
img["src"] = f"{self.api.base_url}{src}"
if img.get("srcset", None):
del img["srcset"]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="canonicalwebteam.discourse",
version="5.4.8",
version="5.4.9",
author="Canonical webteam",
author_email="[email protected]",
url="https://github.com/canonical/canonicalwebteam.discourse",
Expand Down

0 comments on commit 948374a

Please sign in to comment.