damus-io / damus

iOS nostr client
GNU General Public License v3.0
1.99k stars 287 forks source link

Npub crashes damus #2341

Closed alltheseas closed 1 month ago

alltheseas commented 1 month ago

Going to this profile consistently crashes damus for me: npub1gujeqakgt7fyp6zjggxhyy7ft623qtcaay5lkc8n8gkry4cvnrzqd3f67z

@tyiu confirmed behavior

alltheseas commented 1 month ago

This is @patrickreiis npub

Not sure if this damus reaction to something Soapbox does that damus doesn't expect.

cc @alexgleason

jb55 commented 1 month ago

I'll debug

patrickReiis commented 1 month ago

I'll debug

I didn't know about this issue, btw, thanks for creating zaps!

danieldaquino commented 1 month ago

Wrote a fix! All details can be found at https://github.com/damus-io/damus/pull/2365

@jb55 please let me know if you have any questions or concerns. Thank you!

alltheseas commented 1 month ago

Thanks Daniel. Was this a bug solely caused by damus? Is there a fix you might suggest for the app @patrickReiis used to create his profile?

danieldaquino commented 1 month ago

Thank you @alltheseas, that's a good question. This bug is not solely caused by Damus. The client that @patrickReiis used to post this note seems to have a bug as well on its implementation of NIP-94, as it produced a note which included invalid image dimension metadata.

More specifically:

{
    "created_at":1717254346,
    "content":"Got zaps working (now I need to work in the design)\n\n\nhttps:\/\/video.nostr.build\/b986b1cbbde4f1f339ccef58eb5a73df13f3fce908d1c460ee28f12040708b19.mp4","id":"06c0de77f2c8bbbc4b93547f5694cef5145df939ceaf6fa173bf716525c29989",
    "pubkey":"47259076c85f9240e852420d7213c95e95102f1de929fb60f33a2c32570c98c4",
    "tags":[
        [
            "imeta",
            "url https:\/\/video.nostr.build\/b986b1cbbde4f1f339ccef58eb5a73df13f3fce908d1c460ee28f12040708b19.mp4",
            "m video\/mp4",
            "x a346d3441cd1cb97f5b5b25a34cce10152426c5ab8f7df13d98175b72954201c",
            "oxb986b1cbbde4f1f339ccef58eb5a73df13f3fce908d1c460ee28f12040708b19",
            "size 6585344",
            "dim 0x0",    <=== This is invalid
            "blurhash LEHV6nWB2yk8pyo0adR*.7kCMdnj"
        ]
    ],
    "sig": "28569b3380ca1646cc2b64f25b9731fd153751eff70a193972849ebc632f4e7b535e896fe97c01e89b08d94b16db297b998c5aba9c38da4152cc9602daddac1e",
    "kind": 1
}
alexgleason commented 1 month ago

Yes, this was a bug in Ditto with our uploader to nostr.build. Now we don't publish 0x0 values there anymore. This also caused problems in our own client.