Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashfix: test for empty string in mentions #1171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davotoula
Copy link
Contributor

Observing a crash when trying to comment on a specific note. Root cause looks a missing hex in the mention tag of the post:

{ "id": "2be8bcd50a46628a08523c4b638406e04d1d7ab75c8f9ede5aaaf568e4bde081", "pubkey": "20986fb83e775d96d188ca5c9df10ce6d613e0eb7e5768a0f0b12b37cdac21b3", "created_at": 1730957039, "kind": 1, "tags": [ [ "p", "", "", "mention" ] ],

Event ID: nevent1qqszh69u659yvc52ppfrcjmrssrwqnga02m4eru7med24atguj77pqgpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtczyqsfsmac8em4m9k33r99e803pnndvylqadl9w69q7zcjkd7d4ssmxqcyqqqqqqgx0u6l0

The isValidHex function specifically fails empty hexes so I filter out the empty hex mention in the calling NewPostViewModel class.

Copy link
Contributor

@KotlinGeekDev KotlinGeekDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, though the root issue I suspect, is the client producing this event. It will probably need to be reported to them.

@davotoula
Copy link
Contributor Author

Yes.. I need to check nostr docs whether empty mentions like that are valid.. Or maybe just not defined.

In any case amethyst should expect malformed messages and not crash. Display a toast to user.. Or just ignore silently?

@KotlinGeekDev
Copy link
Contributor

KotlinGeekDev commented Nov 7, 2024

@davotoula you seem not to be the only one to have noticed(based on the replies to that note), and from opening it on many clients, most silently ignore it, and render it as is ("@npub1..."). Only Coracle looks for the referenced profile.

@KotlinGeekDev
Copy link
Contributor

IMHO we should silently ignore it, and inform the devs of the source client for this note.

@KotlinGeekDev
Copy link
Contributor

IMG_20241107_132212
@davotoula seems to work on Amethyst?

@davotoula
Copy link
Contributor Author

That's with the debug build from pull request

@KotlinGeekDev
Copy link
Contributor

That's with the debug build from pull request

This is actually with the latest release build.

@davotoula
Copy link
Contributor Author

@KotlinGeekDev can you please double check? I really don't see how it could work with release build.

Note id: nostr:nevent1qqszh69u659yvc52ppfrcjmrssrwqnga02m4eru7med24atguj77pqgpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtczyqsfsmac8em4m9k33r99e803pnndvylqadl9w69q7zcjkd7d4ssmxqcyqqqqqqgx0u6l0

@KotlinGeekDev
Copy link
Contributor

@KotlinGeekDev can you please double check? I really don't see how it could work with release build.

Note id: nostr:nevent1qqszh69u659yvc52ppfrcjmrssrwqnga02m4eru7med24atguj77pqgpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtczyqsfsmac8em4m9k33r99e803pnndvylqadl9w69q7zcjkd7d4ssmxqcyqqqqqqgx0u6l0

Got it.

@KotlinGeekDev
Copy link
Contributor

IMG_20241107_152001
@davotoula seems to work(Latest release build downloaded from Obtainium).

@davotoula
Copy link
Contributor Author

Which reply from above do you think shows it works with latest amethyst release?

@davotoula
Copy link
Contributor Author

By the way, viewing works.

It crashes if you click the create a comment button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants