Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(gnoweb): simplify url parsing system #3366
base: master
Are you sure you want to change the base?
fix(gnoweb): simplify url parsing system #3366
Changes from all commits
f82ec43
e28401a
4c6535a
5d855d7
039b9ed
9f7b111
d44ea6b
d809304
7db64ce
6a07ed2
ed3709c
3a5a71c
6ffc310
0c41f48
c88c186
bff4a0b
90318c7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 97 in gno.land/pkg/gnoweb/url.go
Codecov / codecov/patch
gno.land/pkg/gnoweb/url.go#L96-L97
Check warning on line 147 in gno.land/pkg/gnoweb/url.go
Codecov / codecov/patch
gno.land/pkg/gnoweb/url.go#L146-L147
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we used
gnolang.IsPurePackagePath
/gnolang.IsRealmPath
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To check the string path directly? Or do you mean removing the check and using
IsPurePackagePath
andIsRealmPath
? I would like to haveIsPurePackagePath
andIsRealmPath
; I think it's a better idea thanKind()
, but I'm not sure why you pointed out this specific line.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had beef with this regex and this seemed a good place where to make a comment :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah, I think we can also substitute this regex to determine if it's a valid path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should forbid a URL that is neither pure nor a realm. I prefer this package to perform minimal checks; it should be the caller's choice to accept the URL based on the parsed information. That said, we can still establish a minimal base to work on without assuming any urls.
What do you think about:
File
field, trimming any file from the path when parsing and adding it to the structure.I understand that currently only pure and realm exist, but
gnoweb
will likely extend this with/u
, for example. So it makes sense to me to makeGnoURL
a bit more flexible in what it can parse. This way, the caller can decide whether to use it as a direct call to the node or to redirect the user to something else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thehowl suggestion preview: gfanton@d0eb4b0
Check warning on line 157 in gno.land/pkg/gnoweb/url.go
Codecov / codecov/patch
gno.land/pkg/gnoweb/url.go#L157
Check warning on line 163 in gno.land/pkg/gnoweb/url.go
Codecov / codecov/patch
gno.land/pkg/gnoweb/url.go#L163