Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajrbyers
Copy link
Member

@ajrbyers ajrbyers commented Oct 2, 2024

  • 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

Copy link
Contributor

@StephDriver StephDriver left a comment

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 assigned joemull and unassigned StephDriver Oct 3, 2024
@ajrbyers
Copy link
Member Author

ajrbyers commented Oct 3, 2024

@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
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
Copy link
Member Author

Added @mauromsl for second review.

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