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

fix(gnoweb): simplify url parsing system #3366

Merged
merged 23 commits into from
Jan 8, 2025

Conversation

gfanton
Copy link
Member

@gfanton gfanton commented Dec 18, 2024

This PR simplifies the URL parsing system:

  • Removes the complex regexp that was introduced in the gnoweb revamp.
  • Adds a bunch of new parsing tests for GnoURL.
  • Makes the Encode method more composable to adapt to various use cases.

@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Dec 18, 2024
@gfanton gfanton changed the title fix(gnoweb): simplify url system fix(gnoweb): simplify url parsing system Dec 18, 2024
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 18, 2024

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: gfanton/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 91.30435% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gno.land/pkg/gnoweb/url.go 91.13% 5 Missing and 2 partials ⚠️
gno.land/pkg/gnoweb/handler.go 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@alexiscolin
Copy link
Member

Should we update the breadcrumb (to add the query path) in the same PR?

@Kouteki Kouteki added the in focus Core team is prioritizing this work label Dec 20, 2024
@Kouteki Kouteki requested a review from alexiscolin December 20, 2024 12:04
@gfanton
Copy link
Member Author

gfanton commented Dec 20, 2024

@alexiscolin I will do this in another PR ;)

gno.land/pkg/gnoweb/url.go Outdated Show resolved Hide resolved
gno.land/pkg/gnoweb/url.go Show resolved Hide resolved
gno.land/pkg/gnoweb/url.go Outdated Show resolved Hide resolved
gno.land/pkg/gnoweb/url.go Show resolved Hide resolved
- Removing the concept of "kind" within the structure while still providing helpers to check if the method is pure or a realm:
- Adding a new File field, trimming any file from the path when parsing and adding it to the structure.
- Refining the regex to define what a path can be, based on what we have in `gnovm/pkg/gnolang/helpers.go`
"var rePkgOrRealmPath = regexp.MustCompile(`^/[a-z][a-z0-9_/]*$`)"

Signed-off-by: gfanton <[email protected]>
@gfanton gfanton force-pushed the fix/fgnoweb/simplify-url branch from 8d51e3b to 8f93987 Compare December 26, 2024 15:31
@gfanton gfanton requested a review from thehowl January 6, 2025 10:16
@gfanton gfanton force-pushed the fix/fgnoweb/simplify-url branch from c6e36df to 62b005a Compare January 6, 2025 10:36
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks good 💯

Feel free to merge 🚀

gno.land/pkg/gnoweb/app_test.go Show resolved Hide resolved
gno.land/pkg/gnoweb/url.go Show resolved Hide resolved
gno.land/pkg/gnoweb/url.go Show resolved Hide resolved
@gfanton gfanton merged commit 6472eea into gnolang:master Jan 8, 2025
56 checks passed
@gfanton gfanton deleted the fix/fgnoweb/simplify-url branch January 8, 2025 16:38
albttx pushed a commit that referenced this pull request Jan 10, 2025
thehowl added a commit that referenced this pull request Jan 16, 2025
depends on #3366 

This PR cleans up, documents, and reorganizes the `gnoweb` package,
which was recently revamped:

* Refactored the code for better readability and structure, and added
enhanced comments.
* Enhanced existing test cases:
	* Added new test cases for `assets` in `app_test.go`.
	* Included a new test rule in the Makefile.
	* Created new tests for WebHandler in `handler_test.go`.
* Improved file and directory handling methods in `handler.go`.

---------

Signed-off-by: gfanton <[email protected]>
Co-authored-by: Morgan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in focus Core team is prioritizing this work 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Development

Successfully merging this pull request may close these issues.

6 participants