openlibhums / openlibhums/janeway

Fallbacks for news item images do not work in path mode

Open
#3,501 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
238
Forks
97
Avg merge
9d 1h
Merged PRs (30d)
8

Description

Describe the bug
When you use path mode, the fallback system for news item images does not work, because the journal code gets added to the path, but the media files are stored at a higher level so that NGINX can serve them.

Janeway version
1.5.0

To Reproduce
Steps to reproduce the behavior:

  1. Set a live journal to path mode
  2. Load images into the journal's default large image and default cover image
  3. Create a news item without a dedicated image
  4. Check the news item and see that the fallbacks are not loading. Example: https://olhbeta.janeway.systems/test/news/8/
  5. Note that the error does not appear locally as this URL provides the path during development and testing: https://github.com/BirkbeckCTP/janeway/blob/master/src/core/urls.py#L33

Context

A likely culprit is the logic set up by this function:

https://github.com/BirkbeckCTP/janeway/blob/8c6fbaddedca54fa429ae4fab662ba97e601fb20/src/comms/models.py#L94-L124

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the fallback-related function in src/comms/models.py at lines 94-124, then compare its path handling with src/core/urls.py around line 33. Reproduce the issue with a journal in path mode, default large and cover images, and a news item without its own image. Done means both fallback images load for the news item in path mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.