Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmwangemi committed Jan 25, 2024
1 parent c39ba95 commit c72d88a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions peachjam/views/generic_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,17 @@ def get_notices(self):

def prefix_images(self, document):
"""Rewrite image URLs so that we can server them correctly."""
root = html.fromstring(document.content_html)
if document.content_html and not document.content_html_is_akn:
root = html.fromstring(document.content_html)

for img in root.xpath(".//img[@src]"):
src = img.attrib["src"]
if not src.startswith("/") and not src.startswith("data:"):
img.attrib["src"] = (
document.expression_frbr_uri + "/media/" + img.attrib["src"]
)
for img in root.xpath(".//img[@src]"):
src = img.attrib["src"]
if not src.startswith("/") and not src.startswith("data:"):
img.attrib["src"] = (
document.expression_frbr_uri + "/media/" + img.attrib["src"]
)

document.content_html = html.tostring(root, encoding="unicode")
document.content_html = html.tostring(root, encoding="unicode")


class CSRFTokenView(View):
Expand Down

0 comments on commit c72d88a

Please sign in to comment.