Skip to content

Pleroma note import - Use hashed filename for exists check

Ghost User requested to merge gh-b77c0252/283/unknown/pler-note-import into develop

Created by: smitten

What

Adds a file URL hash to the imported attachment filename. Also adds comment field for alt text.

Why

Pleroma allows for duplicate filenames because it stores the original filename on upload. They are differentiated by a UUID directory path.

When Sharkey imports these, it causes the incorrect attachment to be set on a note. The first note for a given filename is reused and attached incorrectly.

I also set comment to be file.name so that alt text would import on the Drive entries.

Additional info

This post was imported from my Akkoma instance: https://keytest.portend.place/notes/9nghfgbi2fzo01iq

It should have this attachment: https://portend.place/media/f6770d4f-d542-46a1-bd4e-7729c3371ebe/image.png

But instead it got this attachment, because image.png matched the existence check: https://portend.place/media/73468bfa-258a-4872-ae53-c6ceecd3cf82/image.png

This is my first time trying to contribute and I'm very lost! I don't know how to rebuild my server to test it out, and I'm not sure that an MD5 hash is the right way to solve this problem. Any input is welcome!

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

Merge request reports