Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AT to AP - Strange link, or link applied to wrong text #1123

Closed
hybridhavoc opened this issue Jun 9, 2024 · 6 comments
Closed

AT to AP - Strange link, or link applied to wrong text #1123

hybridhavoc opened this issue Jun 9, 2024 · 6 comments
Labels

Comments

@hybridhavoc
Copy link

Just ran across an odd issue I thought I would bring up here. A Bluesky post bridged over to ActivityPub has a link in a weird place.

The original Bluesky post has an @ mention for bsky.app which is displayed as a link on Bluesky. On the AP side there is no link on the @ mention, but there is a link on a different set of 9 characters.

User page on fed.brid.gy: https://fed.brid.gy/bsky/aielcakes.bsky.social

Unfortunately it doesn't look like there's a log available for that post.

@enwin
Copy link

enwin commented Jun 9, 2024

I'm seeing the same issue with hashtags and @ mentions as well.

The first hashtag is properly mapped to a fediverse hashtag, but not the following ones. They also display a link displacement, same for the following @ mention.

User page on fed.brid.gy: https://fed.brid.gy/bsky/origasky.bsky.social

@snarfed
Copy link
Owner

snarfed commented Jun 9, 2024

Oof, yeah. Sorry! Will fix.

snarfed added a commit to snarfed/granary that referenced this issue Jun 9, 2024
@snarfed
Copy link
Owner

snarfed commented Jun 9, 2024

Background: snarfed/granary@e08550e interacted badly with #990 and b4124bd. I'm rolling back snarfed/granary@e08550e, which should fix this regression, but that means AP => Bluesky profile bios still won't have meaningful whitespace, ie newlines won't show up. I'll need to figure that out.

@snarfed
Copy link
Owner

snarfed commented Jun 9, 2024

Sadly Mastodon's .status__content p { white-space: pre-wrap } style doesn't apply to profile bios, they have class account__header__content instead.

bridgy-fed/activitypub.py

Lines 810 to 816 in 551637f

# wrap in <p>. some fediverse servers (eg Mastodon) have a white-space:
# pre-wrap style that applies to p inside content. this preserves
# meaningful whitespace in plain text content.
# https://github.com/snarfed/bridgy-fed/issues/990
if not content.startswith('<p>'):
content = obj_or_activity['content'] = f'<p>{content}</p>'
obj_or_activity['content_is_html'] = True

Good motivation, really I want to bring back the \n => <br> translation anyway instead of depending on a project-specific CSS like that to preserve whitespace.

@snarfed snarfed added the now label Jun 9, 2024
@snarfed
Copy link
Owner

snarfed commented Jun 9, 2024

OK, the regression here should be fixed. Example: https://bsky.app/profile/snarfed.bsky.social => https://indieweb.social/@snarfed.bsky.social@bsky.brid.gy/112587591636781521

I'll leave this open to figure out the rest.

@snarfed
Copy link
Owner

snarfed commented Jun 10, 2024

OK, fixed preserving whitespace in AP => Bluesky bios. Example: https://bsky.app/profile/evan.cosocial.ca.ap.brid.gy

@snarfed snarfed closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants