Skip to content

Commit

Permalink
Handle more places where "publicdomain" can be problematic
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed Apr 29, 2024
1 parent 1c4264b commit a1252b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/api/models/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ def license_url(self) -> str:
def attribution(self) -> str:
"""Legally valid attribution for the media item in plain-text English."""

lic = self.license.lower()
if lic == "publicdomain":
lic = "pdm"
return get_attribution_text(
self.license.lower(),
lic,
self.title,
self.creator,
self.license_version,
Expand Down
5 changes: 4 additions & 1 deletion api/api/utils/watermark.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ def _print_attribution_on_image(img: Image.Image, image_info):

font = ImageFont.truetype(_get_font_path(), size=font_size)

lic = image_info["license"]
if lic == "publicdomain":
lic = "pdm"
text = get_attribution_text(
image_info["license"],
lic,
image_info["title"],
image_info["creator"],
image_info["license_version"],
Expand Down

0 comments on commit a1252b3

Please sign in to comment.