Skip to content

Commit 01e96bf

Browse files
committed
import: handle image attachments with null description (fix #51)
1 parent 8a60a9a commit 01e96bf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/akkoma.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct ApiStatusTag {
3232
#[derive(Deserialize)]
3333
pub struct ApiMediaAttachment {
3434
pub r#type: String,
35-
pub description: String,
35+
pub description: Option<String>,
3636
pub url: String,
3737
pub preview_url: String,
3838
}
@@ -53,7 +53,7 @@ pub struct AkkomaImgTemplate {
5353
pub data_akkoma_src: String,
5454
pub href: String,
5555
pub src: String,
56-
pub alt: String,
56+
pub alt: Option<String>,
5757
}
5858

5959
impl From<&ApiAccount> for Author {

templates/akkoma-img.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a target="_blank" href="{{ href }}"><img loading="lazy" data-akkoma-src="{{ data_akkoma_src }}" src="{{ src }}" alt="{{ alt }}"></a>
1+
<a target="_blank" href="{{ href }}"><img loading="lazy" data-akkoma-src="{{ data_akkoma_src }}" src="{{ src }}"{% if let Some(alt) = alt %} alt="{{ alt }}"{% endif %}></a>

0 commit comments

Comments
 (0)