Skip to content

Fix paths of old foodsharepoint pictures

Alex requested to merge fix-fsp-picture-path into master

Closes #1490 (closed)

What does this MR do?

Problem with photos of food share points that were uploaded with the old API:

  • the file path is saved in the database as picture/{id}.jpg
  • when you edit a foodsharepoint, the gateway converts the path to /images/picture/{id}.jpg because the edit form needs the full path
  • when you submit the form, it is written as /images/picture/{id}.jpg into the database

This workaround removes the /images/ prefix in the backend before storing it in the database.

How confident are you it won't break things if deployed?

It should work if we also correct all broken paths in the db.

How to test

  1. Checkout branch locally
  2. Put a picture file into /images/picture/{id} and also create the /images/picture/crop_0_528_{id} version
  3. Find a food share point in the database (fs_fairteiler) and set its picture to picture/{id}
  4. Login as userbot or userorga
  5. Open the page of that FSP and check that you see the title picture
  6. Edit the FSP. You should see the picture in the edit form.
  7. Submit without changing the picture. You should still see it on the FSP page.

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • set a "for:" label to indicate who will be affected by this change
  • added to the next milestone (see https://gitlab.com/foodsharing-dev/foodsharing/-/milestones, unless it has a "for:Dev" label)
  • added an entry to CHANGELOG.md
  • added a short text that can be used in the release notes
  • Once your MR has been merged, you are responsible to create a testing issue in the Beta Testing forum: https://foodsharing.de/?page=bezirk&bid=734&sub=forum. Please change the MRs label to "state:Beta testing".
    • Consider writing a detailed description in German.
    • Describe in a few sentences, what should be tested from a user perspective.
    • Also mention different settings (e.g. different browsers, roles, ...) how this change can be tested.
    • Be aware, that also non technical people should understand.

Release notes text in German

Merge request reports