microdotblog / microblog-react

MIT License
29 stars 3 forks source link

Posting photo to external blog returns `undefined` for photo URL #52

Closed paulrobertlloyd closed 11 months ago

paulrobertlloyd commented 1 year ago

When trying to post an image, the image URL is not present in the data sent to the Micropub server.

Steps to reproduce:

With Indiekit, this results in the following post file being created:

---
date: 2023-06-30T22:19:40.234+01:00
photo:
  - url: undefined
    alt: Alt 1
---

Test post 1

It would seem that Micro.blog is unable to get the url returned by the media endpoint, and/or fails to add this to the submitted post data.

Notes:

bwlng commented 11 months ago

It appears this is a result of the app expecting the url to be in the response body.

https://github.com/microdotblog/microblog-react/blob/370ec3756e572e6782c53fec313568a8be551fa4/src/stores/models/posting/MediaAsset.js#L27-L32

In the previous version of the iOS client, the uploaded image’s URL was pulled from the location header which matches the Micropub recommendation for the Media Endpoint response.

HTTP/1.1 201 Created
Location: https://media.example.com/file/ff176c461dd111e6b6ba3e1d05defe78.jpg
manton commented 11 months ago

Thanks, we can fix this for the next version.

vincentritter commented 11 months ago

Got a fix for this and will be available in the 3.2 release on iOS and 1.9 on Android.