Skip to content

Commit

Permalink
fix: handle broken link for the missing image file
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie Rymer committed Apr 23, 2024
1 parent 992e1c6 commit 430c303
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/oscar/apps/catalogue/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,9 @@ def __init__(self, name=None):
self.symlink_missing_image(media_file_path)

def symlink_missing_image(self, media_file_path):
if os.path.islink(media_file_path):
# broken link, remove it to create it anew
os.unlink(media_file_path)

Check warning on line 1521 in src/oscar/apps/catalogue/abstract_models.py

View check run for this annotation

Codecov / codecov/patch

src/oscar/apps/catalogue/abstract_models.py#L1521

Added line #L1521 was not covered by tests
static_file_path = find("oscar/img/%s" % self.name)
if static_file_path is not None:
try:
Expand Down

0 comments on commit 430c303

Please sign in to comment.