-
Notifications
You must be signed in to change notification settings - Fork 375
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: limitation for length of package/realm path #2108
Conversation
relate to #2053 |
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.
Thank you for adding this guard 🙏
There are some things that need to be addressed before moving forward, but overall the PR looks good 💯
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.
Here, we are trying to kill a fly with a thermal nuclear weapon (a regex).
There are 2 ways this can be implemented reasonably.
- calling the builtin function
len
and the limit being imposed on the number of bytes - calling
utf8.RuneCountInString
and the limit being imposed on the number of characters
I personally think you should use len
and limit the path to 256 bytes because it still does the job but it is much faster than the alternative.
I think bytes limitation is good for this. I will update it. |
@zivkovicmilos @petar-dambovaliev |
modified: tm2/pkg/std/memfile_test.go
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2108 +/- ##
=======================================
Coverage 49.93% 49.93%
=======================================
Files 576 576
Lines 77825 77827 +2
=======================================
+ Hits 38862 38863 +1
Misses 35837 35837
- Partials 3126 3127 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul |
<!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Thinh <thinhnx@192.168.1.9> Co-authored-by: Thinh <thinhnx@thinhnx.local> Co-authored-by: Thinh <thinhnx@192.168.1.6> Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com> Co-authored-by: Morgan Bazalgette <morgan@morganbaz.com>
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description