mastodon / mastodon-ios

Official iOS app for Mastodon
https://app.joinmastodon.org/ios
GNU General Public License v3.0
2.09k stars 269 forks source link

[BUG] Newlines in posts from Pleroma aren't displayed. #896

Open al45tair opened 1 year ago

al45tair commented 1 year ago

Is there an existing issue for this?

Current Behavior

If you post in Pleroma a message that includes newlines, for instance:

Hello.

This is a test.

then the Mastodon app displays the post as

Hello.This is a test.

It clearly displays newlines from Mastodon toots properly. My guess is that this might be an LF vs CR-LF issue?

Expected Behavior

Messages with newlines should show up correctly.

Steps To Reproduce

  1. Using a Pleroma instance, post a message that contains newlines. For instance:

    This is a test message to help file a bug report.

    It contains newlines.

  2. View the message using the Mastodon app. It will look like this:

    This is a test message to help file a bug report.It contains newlines.

Environment

- Device: iPhone 13 Pro
- OS: iOS 16.2
- Version: v1.4.9
- Build: 224

Anything else?

Message in Pleroma Message in Mastodon iOS App
j-f1 commented 1 year ago

Strange, on my end it works fine:

My guess is that Pleroma’s implementation of the Mastodon API has a bug where it returns an improper response. This app expects HTML-formatted message content which is then parsed.
al45tair commented 1 year ago

I would imagine (I haven't checked) that Pleroma is generating text with just an LF character rather than CR-LF. It's probably a Pleroma bug (since HTML and XML are supposed to have CR-LF line endings, right?) but nevertheless it might make sense for the Mastodon client to adhere to the "liberal in what it accepts" principle.

taku0 commented 6 days ago

Official Android app for Mastodon properly shows newlines from Pleroma. Maybe #1060 relates this issue.

taku0 commented 4 days ago

Pleroma uses <br/> (without spaces) for newlines while Mastodon uses <br /> (with a space). MetaTextKit accepts only <br> and <br />. I have made a PR for MetaTextKit.

https://github.com/TwidereProject/MetaTextKit/pull/8

taku0 commented 17 hours ago

@kimar A possible fix for this issue has been merged into MetaTextKit. Could you merge it to the mastodon/MetaTextKit fork and test it? https://github.com/TwidereProject/MetaTextKit/pull/8

kimar commented 16 hours ago

Thank you @taku0 for the heads-up. I'm relaying this to @whattherestimefor as I'm not actively developing for Mastodon for iOS anymore.