lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

[Bug]: Media links added to posts via Friendica don't appear

Open N-Upchurch opened this issue 10 months ago • 5 comments

Requirements

  • [x] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
  • [x] Did you check to see if this issue already exists?
  • [x] Is this only a single bug? Do not put multiple bugs in one issue.
  • [x] Do you agree to follow the rules in our Code of Conduct?
  • [x] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

Per my bug report for Friendica, when adding a media link through Friendica's "add link or media" button to a post to a Lemmy community, the media fails to appear in the resulting post. (Note: in the post I linked, I edited after the fact to add a link to the video as none appeared after creating the post initially.)

Steps to Reproduce

  1. Go to a Lemmy community via Friendica
  2. Click "Compose"
  3. Use the "Link or Media" button in the compose modal to add a YouTube video
  4. Post
  5. View post on Lemmy

Technical Details

n/a

Version

0.19.9

Lemmy Instance URL

lemmy.ml

N-Upchurch avatar Mar 13 '25 14:03 N-Upchurch

Looking at how Frendica handles links (sorry for rummaging through your profile for a post with a link), it doesn't seem that Frendica puts links in the attachment field like Lemmy expects. I suppose we could fetch the Opengraph data for the first link in content field like what Mastodon et al. does, but that would go against how most Lemmy users expect putting links in the post body to work. If, in the HTML, Frendica could indicate that a link is an attachment and not an inline link, like what's in the BBCode, we could filter for it.

flamingos-cant avatar Mar 14 '25 06:03 flamingos-cant

Yes this is working as expected for Lemmy, it only takes the post url from attachment. Text in content is rendered as is for the post body. I assume that Friendica has some way to add link attachments so give that a try.

Nutomic avatar Mar 14 '25 10:03 Nutomic

There are two ways to add links on Friendica - you can use Markdown or BBCode to include it in the post body, or you can add it through the "add link or media" button. This button is what I used for my post to a Lemmy community. (Again, the link in the post body was added after the fact because the link I included initially didn't show up at all.)

I'm not sure which method I used for the post that @flamingo-cant-draw found, but I certainly did use the latter for my post to lemmy.ml/c/dnb, in which case it may point to an issue with how Friendica handles links, is that right?

N-Upchurch avatar Mar 14 '25 16:03 N-Upchurch

@N-Upchurch Here's the (relevent) ActivityPub for that post:

"content": "<a href=\"https://www.youtube.com/watch?v=QcfcwWTQKzo\" target=\"_blank\" rel=\"noopener noreferrer\">youtube.com/watch?v=QcfcwWTQKz…</a>",
  "contentMap": {
    "en": "<bdi>!<a href=\"https://lemmy.ml/c/dnb\" class=\"userinfo mention\" title=\"dnb\">dnb</a></bdi><br><a href=\"https://www.youtube.com/watch?v=QcfcwWTQKzo\" target=\"_blank\" rel=\"noopener noreferrer\">youtube.com/watch?v=QcfcwWTQKz…</a><br><a href=\"https://www.youtube.com/watch?v=QcfcwWTQKzo\" target=\"_blank\" rel=\"noopener noreferrer\">Enter a title</a>"
  },
  "source": {
    "content": "![url=https://lemmy.ml/c/dnb]Drum and Bass music[/url]\n[youtube]QcfcwWTQKzo[/youtube]\n[attachment type='link' url='https://www.youtube.com/watch?v=QcfcwWTQKzo' title='Enter a title'][/attachment]",
    "mediaType": "text/bbcode"
  },
  "attachment": [],

I assume what's inside the content field is what you edited in to make the link appear on Lemmy, so it was presumably blank before you edited it. It's weird that Frendica is trying to differentiate attachments from the main post body by having different blobs of HTML and I'm not sure how we'd process that reliably on our end.

flamingos-cant avatar Mar 16 '25 08:03 flamingos-cant

Thanks for the information; I'll pass this along in my Friendica bug report.

N-Upchurch avatar Mar 16 '25 18:03 N-Upchurch

Responded to the Friendica issue, their use of url for links is not standard compliant.

Nutomic avatar Jun 19 '25 13:06 Nutomic