Skip to content

Commit

Permalink
wrap long avatar headers
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Feb 6, 2025
1 parent 33bd262 commit 71b7e5e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mimefactory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,17 @@ async fn build_avatar_file(context: &Context, path: &str) -> Result<String> {
false => BlobObject::from_path(context, path.as_ref())?,
};
let body = fs::read(blob.to_abs_path()).await?;
let encoded_body = base64::engine::general_purpose::STANDARD.encode(&body);
let encoded_body = base64::engine::general_purpose::STANDARD
.encode(&body)
.chars()
.enumerate()
.fold(String::new(), |mut res, (i, c)| {
if i % 78 == 77 {
res.push(' ')
}
res.push(c);
res
});
Ok(encoded_body)
}

Expand Down

0 comments on commit 71b7e5e

Please sign in to comment.