microdotblog / sunlit

Publish photos to your own blog — hosted by Micro.blog or compatible blogs using WordPress or Micropub — and discover beautiful photos from other users.
https://sunlit.io
MIT License
50 stars 7 forks source link

Use a unique UUID-derived filename for image and movie uploads to micropub endpoints #135

Closed lildude closed 4 years ago

lildude commented 4 years ago

Whilst experimenting with Sunlit, I noticed that image and movie uploads to an external micropub endpoint always use the filename: image.jpg and movie.mov respectively.

On examining the source, I noticed that uploads to XMLRPC endpoints however don't and instead use a UUID-derived filename:

https://github.com/microdotblog/sunlit/blob/65567259f39b4739e1e80e40b3195aeaf426f9a4/Libraries/Snippets/Snippets%2BXMLRPC.swift#L158

https://github.com/microdotblog/sunlit/blob/65567259f39b4739e1e80e40b3195aeaf426f9a4/Libraries/Snippets/Snippets%2BXMLRPC.swift#L205

This PR implements the same logic for micropub image and movie uploads.

Note: this PR targets the 3.2 branch as I believe master represents the current stable 3.0 release. I can re-target if you'd prefer this to target master.

Fixes https://github.com/microdotblog/sunlit/issues/131

lildude commented 4 years ago

Confirmed this used the UUID-derived filename in build 383. Thanks @cheesemaker 🙇