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

Profile picture uploads cause 500 error due to randomised file extensions #788

Open
1 of 2 tasks
OscarSeip opened this issue Jan 13, 2025 · 2 comments
Open
1 of 2 tasks
Assignees
Labels
hot-fix quick software update or code change that fixes a bug or defect in a live system medium priority

Comments

@OscarSeip
Copy link
Collaborator

OscarSeip commented Jan 13, 2025

User story: As a user of lowFAT, I want my uploaded profile pictures to display correctly without errors, so that the Fellows’ profiles pages are fully functional and visually complete.

Description: When a user or admin uploads a profile picture for a Fellow's account in lowFAT, the image file name is saved with a random string appended to the extension (e.g., photos/profilepic_kxxJUOf.jpg). However, the system attempts to retrieve the image using a different file path (e.g., photos/profilepic.jpg), causing a 500 error when the image is not found. After a few refreshes, the page loads but with broken links for the profile pictures. This is causing secondary problems in clicking through on the Fellow's page.

Acceptance criteria:

  • Uploaded profile pictures are saved with consistent file paths and names.
  • The application retrieves and displays uploaded profile pictures correctly without any errors.
@OscarSeip OscarSeip added the hot-fix quick software update or code change that fixes a bug or defect in a live system label Jan 13, 2025
@phillybroadbent
Copy link
Collaborator

If you upload an image with a unique name the image will be saved using the name specified. The random letter string is only added to the image name if an image with the same name has already been uploaded. For some reason, lowFAT is failing to find the images with the random letter string after it.

There was a separate issue of the package Pillow not being compatible with the photo resizing function in version 10.2.0. Pillow has been downgraded to 9.5.0 to fix this part of the problem for now.

At the moment, photo upload works as long as the photo uploaded does not have the same name as an image already known by lowFAT.

@OscarSeip
Copy link
Collaborator Author

Thanks @phillybroadbent for investigating and addressing this issue. I would have expected that, in cases where a file with the same name already exists, the new file would overwrite the existing one. Introducing a random string to the file name might create complications if Fellows decide to update their profile pictures later on.

I'll keep the issue open for now to explore a solution that also addresses the first acceptance criterion: "The application retrieves and displays uploaded profile pictures correctly without any errors."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hot-fix quick software update or code change that fixes a bug or defect in a live system medium priority
Projects
None yet
Development

No branches or pull requests

2 participants