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

Thumbnail template tag does not err gracefully when file not found. #461

Open
bingosabi opened this issue Mar 28, 2018 · 1 comment
Open

Comments

@bingosabi
Copy link

I have a page which displays ~300 thumbnails using the ImageKit thumbnail template tag, but when a single file is not found then the entire page explodes. I encounter this when moving a database from prod to development for testing before I deploy if I don't move all of the accompanying source images and their generated thumbnails.

The Django Template guidelines suggest that tags should err gracefully, as any exception which is raised / not captured will cause such a server error:

Thus, filter functions should avoid raising exceptions if there is a reasonable fallback value to return. In case of input that represents a clear bug in a template, raising an exception may still be better than silent failure which hides the bug.

IMO, this is low priority as there is a workaround (Ensure that database file values link to valid files on disk), but thought I'd at least open an issue as the template tag doesn't adhere to the Django guideline. (It's not a template bug... it's a data issue.)

@vstoykov
Copy link
Collaborator

This looks similar to this one #339. Actually not only with ImageKit if you have missing files and you try to get URL for them in templates it will crash in front of you. I know that is very bad user experience when for some missing file on the page the whole page is gone and you see 500 response.

We need to investigate it further to see how to improve the UX. If you have time and you are willing to came up with a PR I will be very glad.

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

No branches or pull requests

2 participants