element-hq / element-hq/element-x-android
VC 202512000 fails to replace an `"msgtype": "m.image"`'s `body:`'s by-default-`text/plain` `format:` with `/markdown`, upon retroactive caption addition; and removes it upon retroactive caption modification.
- Dominant language
- Kotlin
- Stars
- 2.4k
- Forks
- 624
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 149
Description
#### How To Reproduce It
1. ~~~sh
#!/system/bin/sh
monkey -p io.element.android.x 1
~~~
1. Enter a chat.
- As I was directed to report, at [`element-web/issues/11083#issuecomment-3719762859`](https://github.com/element-hq/element-web/issues/11083#issuecomment-3719762859):
1. Upload an image, but enter no caption.
1. Modify it, to add a caption. Include CommonMark hyperlink syntax.
- As I discovered, in [`!rLtgkIdZhxPpreEWYI:mozilla.org/$jWRGHhCdZFz3GBpcfdL2OnlWwo_ZD2XLTxiB0EE4pKE`](https://matrix.to/#/!rLtgkIdZhxPpreEWYI:mozilla.org/$jWRGHhCdZFz3GBpcfdL2OnlWwo_ZD2XLTxiB0EE4pKE?via=mozilla.org&via=matrix.org&via=matrix.vulpin.com), after filing this issue:
1. Upload an image, but enter a caption that utilises CommonMark `code` syntax.
1. Modify the content of that caption.
I have yet to submit a screencast that demonstrates reproduction of this.
#### The Outcome
- #### What I Expected To Occur
Retroactively adding a caption that contains to-be-rendered CommonMark (and/or HTML5) markup should cause that markup to be rendered.
- #### What Occurred
It solely gains `"format": "org.matrix.custom.html"` if I upload the image *with* a CommonMark caption:
https://github.com/user-attachments/assets/bd778a3e-b6c8-404f-9c21-5ba296d53c04
~~~JSON
{
"content": {
"body": "Another question: I want to test [`id=2004557`](https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=2004557#c0) (and, _if_ reproducible, [`id=2001852`](https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=2001852#c0)) in MozRegression. However, I've no known good build.",
"filename": "1000048141.png",
"format": "org.matrix.custom.html",
"formatted_body": "Another question: I want to testid=2004557<\/code><\/a> (and, if<\/em> reproducible,id=2001852<\/code><\/a>) in MozRegression. However, I've no known good build.",
"info": {
"h": 1905,
"mimetype": "image\/png",
"size": 230022,
"thumbnail_info": {
"h": 635,
"mimetype": "image\/png",
"size": 42228,
"w": 392
},
"thumbnail_url": "mxc:\/\/matrix.org\/pCeujWSNgBognAzLCIJNhBrw",
"w": 1176,
"xyz.amorgan.blurhash": "KAQcuH-p~V00fRNHVED*9G"
},
"msgtype": "m.image",
"url": "mxc:\/\/matrix.org\/lBdyUUDKpfWoNAbcGZKBBaxl"
},
"origin_server_ts": 1767803224225,
"sender": "@rokejulianlockhart:matrix.org",
"type": "m.room.message",
"unsigned": {
"membership": "join",
"age": 8371,
"transaction_id": "f08f03fdc1e3401eb0fa62479520f835"
},
"event_id": "$D7X_TQ4ZPFKZ7YB7QIIkFhXI5Ht6804i9deBlkL9nAE"
}
~~~
If, instead, I upload an image with no caption, but retroactively attach one, the format is not modified from `text/plain` to `/markdown`:
https://github.com/user-attachments/assets/7f9faf91-5254-4218-bd97-994329454416
~~~JSON
{
"content": {
"body": "1000048141.png",
"info": {
"h": 1905,
"mimetype": "image\/png",
"size": 229700,
"thumbnail_info": {
"h": 635,
"mimetype": "image\/png",
"size": 42228,
"w": 392
},
"thumbnail_url": "mxc:\/\/matrix.org\/tzacBPUEwkJKHRTDtQFUpuqM",
"w": 1176,
"xyz.amorgan.blurhash": "KAQcuH-p~V00fRNHVED*9G"
},
"msgtype": "m.image",
"url": "mxc:\/\/matrix.org\/eVXxaDhyOwmORDxtVFSyRtwZ"
},
"origin_server_ts": 1767803284536,
"sender": "@rokejulianlockhart:matrix.org",
"type": "m.room.message",
"unsigned": {
"membership": "join",
"age": 481,
"transaction_id": "b2d91faac95f47219dce809a1509f7f9"
},
"event_id": "$TvIxXJ2RjBC_aMxOw-1ozduaiuhogsj9Bm6lfgMtQQk"
}
~~~
#### Device Model
~~~YAML
[ro.product.brand]: [Fairphone]
[ro.build.product]: [FP5]
~~~
#### OS Version
~~~YAML
[ro.build.id]: [AQ3A.240912.001]
[ro.build.version.release]: [15]
[ro.build.display.id]: [FP5.VT2I.C.072.20251122]
~~~
#### Application Version And Origin
~~~ini
sourcePackage=io.element.android.x
versionCode=202512000
versionName=25.12.0
installerPackageName=com.android.vending
~~~
#### Homeserver
`:matrix.org`
#### Whether I Shall Send Logs
I have:
~~~XML
~~~
#### Whether I Am Willing To Provide A PR
No; I am unable to.
Contributor guide
Assessment
This issue has not been assessed yet.