mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-04-14 06:54:06 +00:00
Add backslahses to prevent image embeds breaking (#5506)
* Replace newlines with spaces in attachments * Use backslash to prevent breaks instead * fmt * Split + join with spaces
This commit is contained in:
parent
d517f16e2c
commit
8e080e4926
1 changed files with 3 additions and 0 deletions
|
@ -133,6 +133,9 @@ impl Attachment {
|
|||
|
||||
let is_image =
|
||||
media_type.is_some_and(|media| media.starts_with("video") || media.starts_with("image"));
|
||||
// Markdown images can't have linebreaks in them, so to prevent creating
|
||||
// broken image embeds, replace them with spaces
|
||||
let name = name.map(|n| n.split_whitespace().collect::<Vec<_>>().join(" "));
|
||||
|
||||
if is_image {
|
||||
let url = proxy_image_link(url, context).await?;
|
||||
|
|
Loading…
Reference in a new issue