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

This one doesn't parse out the link right #54

Open
mikedilger opened this issue Jan 1, 2023 · 3 comments
Open

This one doesn't parse out the link right #54

mikedilger opened this issue Jan 1, 2023 · 3 comments

Comments

@mikedilger
Copy link

An example that isn't parsing out right. Scheme can't have a '.' in it, right?

Just to show.. this is the list of relays that have seen this post.https://nostr.build/i/1105.png
@kosayoda
Copy link

kosayoda commented Jan 1, 2023

It can, according to 3.1. Scheme:

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-").

It cannot start with a period, which means post .https://nostr.build/i/1105.png results in the "expected" output but post.https://nostr.build/i/1105.png does not since post.https is a valid scheme name.

I think a worthwhile feature for this library is to allow restricting schemes, since I would prefer matching https://nostr.build/i/1105.png in this case as well.

@mikedilger
Copy link
Author

I stand corrected.

@robinst
Copy link
Owner

robinst commented Jan 5, 2023

Yeah. I think having an option to provide an allow-list of schemes to recognize would be nice (added a "help wanted" label). You could pass in https, http and it would only return URLs with that (and stop at characters like . or +). It's a bit trickier than that because you could also provide post.https and https and in that case it should probably use the longer match.

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

No branches or pull requests

3 participants