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

[Bug]: Quotation marks and bold in markdown breaks feed #3411

Closed
4 tasks done
skariko opened this issue Jun 29, 2023 · 3 comments · Fixed by #3490
Closed
4 tasks done

[Bug]: Quotation marks and bold in markdown breaks feed #3411

skariko opened this issue Jun 29, 2023 · 3 comments · Fixed by #3490
Labels
bug Something isn't working

Comments

@skariko
Copy link

skariko commented Jun 29, 2023

Requirements

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

Summary

Hello,
if a post contains this markdown sequence: **"some text "** the XML feed will give an nginx 502 Bad Gateway error.

I recreated the problem in my test community.

The post is this: https://feddit.it/post/527823

And the broken feed here: https://feddit.it/feeds/c/test.xml?sort=New

At the time the post is created also appears this error: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Steps to Reproduce

  1. Create a post and inside put this markdown: **"some text "**
  2. Try to get the feed of that community.

Technical Details

Can't find an error but thanks to the support chat on Matrix I was able to find this in the debug:

lemmy_1 | 2023-06-29T14:22:51.326644Z DEBUG HTTP request{http.method=GET http.scheme="http" http.host=feddit.it http.target=/feeds/c/libri.xml otel.kind="server" request_id=0c280053-e4d3-4103-baa2-923a0d28b5b9}:get_feed:get_feed_community: tokio_postgres::query: executing statement s113 with parameters: [ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([255, 255, 255, 255])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 23, array_oid: 1007 })), Some([0, 0, 0, 195])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 16, array_oid: 1000 })), Some([0])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 20, array_oid: 1016 })), Some([0, 0, 0, 0, 0, 0, 0, 20])), ToSqlHelper(PgTypeMetadata(Ok(InnerPgTypeMetadata { oid: 20, array_oid: 1016 })), Some([0, 0, 0, 0, 0, 0, 0, 0]))]

Version

0.18.0

Lemmy Instance URL

feddit.it

@phiresky
Copy link
Collaborator

phiresky commented Jul 5, 2023

opened an upstream issue. this is causing large compounding issue where it cases nginx to mark the upstream as down depending on configurtaion

but maybe we should switch to some more robust/popular markdown library? markdown-it-rust/markdown-it#26

@phiresky
Copy link
Collaborator

phiresky commented Jul 5, 2023

We can't 1:1 replace markdown-it with pulldown-cmark because it does not have the fenced_divs extension of which a subset is implemented for spoiler blocks here:

// Custom Markdown plugin to manage spoilers.

They are also not planning on implementing it: pulldown-cmark/pulldown-cmark#589

A workaround around the bug in markdown-it would be to disable the smartquotes extension for now.

@ninanator
Copy link
Contributor

ninanator commented Jul 5, 2023

@phiresky @skariko - Thank you for reporting this. Since Lemmy was using the default settings for Comrak (which means smart quotes weren't enabled before my PR) I'll open up a PR to disable smart quotes for now.

(This will probably be in the evening for me, so I will check if the markdown-it maintainers have fixed it then. But guessing disabling will be the correct route.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants