snarfed / bridgy

📣 Connects your web site to social media. Likes, retweets, mentions, cross-posting, and more...

Home Page:https://brid.gy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alt text not surviving media post via mastodon api

jk-na opened this issue · comments

Hello,

I'm not sure if this perhaps relates to mastodon seemingly now using a v2 for their media api stuff but having just fixed my site so that alt text sent via the indigenous android app is rendered correctly on my hugo site, I've noticed that the alt text isn't surviving the toot process.

I have a pleroma instance but mainly it adheres to mastodon api and I don't see any pleroma specific api definitions for media.

The original post is here: https://jk.nipponalba.scot/photo/5f626c00/
Image properties in firefox show the correct associated text, and the html for the image is here <img class="u-photo" src="/media/file-20200916204815-1926.jpg" alt="close up of can of fuego sour beer from fierce beer. orange text on black can."/>

The resultant toot is here: https://social.nipponalba.scot/notice/9zE6P3t3hoWYeKLHuK
Image properties in firefox show no associated text and the html for the image is here: <img class="u-photo" src="https://social.nipponalba.scot/media/3bfe1367691c76660ab42c7c1033be10f0e10048c7438ddb4b2551dff8cc60b1.jpg?name=file.jpg" alt="" title="">

hi @jk-na, sorry for the trouble, and thanks for reporting! looks like this is indeed a bridgy bug, i'll take a look soon.

No worries! Thanks for looking into it.

i've deployed a fix for this (snarfed/granary@a742a9b), but i don't have a pleroma account etc set up for testing. @jk-na mind trying again?

tested, but unfortunately it's still not making it through:

original page: https://jk.nipponalba.scot/photo/5f64693d/
original source: <img class="u-photo" src="/media/file-20200918090100-3537.jpg" alt="mug of coffee, partial shot of a boox ereader , notepad and pens."/>

pleroma page: https://social.nipponalba.scot/notice/9zHEJPVXn1234i2Vlo
pleroma source: <img class="u-photo" src="https://social.nipponalba.scot/media/c0a8cca5ef79d9104265c37098d88bebd9a2dd3dc8927db4469d39375001510f.jpg?name=file.jpg" alt="" title="">

hmm! looking at the bridgy log, it correctly sent a description field when it created the media attachment this time, as expected in the Mastodon API. Pleroma accepted the request, and returned 200, but the description field in the response was empty, so they didn't use it or accept it for some reason. not sure why. we may need to talk to them at this point.

I 2020-09-18 08:01:06.200521 requests.post https://social.nipponalba.scot/api/v1/media {'files': {'file': <urllib3.response.HTTPResponse object at 0x3eeb932d36d0>}, 'json': {'description': 'mug of coffee, partial shot of a boox ereader , notepad and pens.'}, 'headers': {'Authorization': '...'}}
I 2020-09-18 08:01:07.925522 Got: {'description': '', 'id': '13144322', 'pleroma': {'mime_type': 'image/jpeg'}, 'preview_url': 'https://social.nipponalba.scot/media/c0a8cca5ef79d9104265c37098d88bebd9a2dd3dc8927db4469d39375001510f.jpg?name=file.jpg';, 'remote_url': 'https://social.nipponalba.sco

OK, thank you. I'll raise a ticket with pleroma and see what they say, might be a site configuration option that I have or haven't enabled but I didn't notice anything when I went through the settings yesterday.

Reply from pleroma creator to my ticket:

"I think the issue is mixing json and whatever method is used to send the files. If you do both using multipart/form-data it should work"

Is this viable?

thanks! yes, that makes sense, and it's an easy fix. i've deployed it. feel free to try again!

Success! Alt text displaying on latest image post via brid.gy! Not for the first time, many thanks!