Skip to content

When attempting to fetch an image for a NewsItem that does not exist a 404 not found error is now returned#4439

Merged
mauromsl merged 1 commit into
masterfrom
b-4438-handle-error
Feb 11, 2025
Merged

When attempting to fetch an image for a NewsItem that does not exist a 404 not found error is now returned#4439
mauromsl merged 1 commit into
masterfrom
b-4438-handle-error

Conversation

@ajrbyers

@ajrbyers ajrbyers commented Oct 2, 2024

Copy link
Copy Markdown
Member
  • Added a try/except block that returns a 404 instead of a 500 when attempting to fetch an image for a NewsItem that does not exist.
  • Closes Unhandled ORM get #4438

@StephDriver StephDriver left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this, and compared to master I can see the change and it works but I have found some strange behaviour:

  • This will return a 404 if the news ID doesn't exist.
  • This will return a 404 if the news ID exists and there is no image for that item.
  • But if there is an image, and you type in a different image number to the one associated with the image in the source of the News Item page, it will still access the image and not 404. Master behaves the same, so this is not introducing a new issue.

So - if the PR is just about non-existent news ID, then I think it does what it is supposed to do, but if it is about non-existent images, then it doesn't because it allows any image number as if it were the correct one as long as the news ID is correct.

e.g.
if image is at: news/id/699/image/166081/

Then news/id/69/image/166081/ will 404 (assuming no other item 69 exists)
But news/id/699/image/166/ will still access the image as if it were news/id/699/image/166081/

I am approving this but leaving it up to the originator to consider the above and decide whether it is working as intended or not, or whether that is a separate issue etc.

@StephDriver StephDriver requested a review from joemull October 3, 2024 08:04
@StephDriver StephDriver assigned joemull and unassigned StephDriver Oct 3, 2024
@ajrbyers

ajrbyers commented Oct 3, 2024

Copy link
Copy Markdown
Member Author

@StephDriver I'm going to take this one back. It looks like the view has changed the way it operates at some point so there are some superflous arguments.

@ajrbyers ajrbyers assigned ajrbyers and unassigned joemull Oct 3, 2024
@ajrbyers ajrbyers removed the request for review from joemull October 3, 2024 08:29
@ajrbyers

Copy link
Copy Markdown
Member Author

@StephDriver I've gone over this and these superflous attributes are there to work with the generic carousel URL pattern (one that can work for a news item, issue or article) so I think this is fine.

@ajrbyers ajrbyers requested a review from mauromsl October 29, 2024 13:33
@ajrbyers

Copy link
Copy Markdown
Member Author

Added @mauromsl for second review.

@ajrbyers ajrbyers added this to the v1.8.0 Tracker milestone Feb 11, 2025
@ajrbyers ajrbyers removed their assignment Feb 11, 2025
@mauromsl mauromsl merged commit 2c63a11 into master Feb 11, 2025
@mauromsl mauromsl deleted the b-4438-handle-error branch February 11, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled ORM get

4 participants