-
Notifications
You must be signed in to change notification settings - Fork 57
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
#pathSegments returns segments that are either Character or ByteString #63
Comments
It was intentional d962746#diff-47063f74b25c99af0ddf4f0840769d07aca3728dabb14c78d1f741f685d75235 but I can't immediately remember why we did this, maybe @noha can ... |
Yes, I'm a mail archiver. The point was that / is valid as trailing slash and that had the problem that
gave http://foo.bar.com/p//otherSegment (not the double slash). You can see this up to pharo7. Now when you do it you get only a single slash how it should be |
Metacello new baseline: 'GToolkit'; repository: 'github://feenkcom/gtoolkit:v0.8.679/src'; load All commits (including upstream repositories) since last build: feenkcom/gtoolkit-releaser@939849 by Andrei Chis fix merge conflict feenkcom/gtoolkit-releaser@bd3405 by Andrei Chis Merge c4ca89f1bbd68cc90a15803f177386cccd5986d4 feenkcom/gtoolkit-releaser@8c8f4d by Andrei Chis Add Zinc and Zodiac with a release strategy of type GtRlBaselineTagReleaseStrategy feenkcom/Pharo-Chrome@a57c7e by Andrei Chis Do not load explicitly the WebSocket package feenkcom/Pharo-Chrome@f67ab5 by Andrei Chis Merge f2e52c468bed3e4e363cd6d94efad9cfceeeeb3e feenkcom/Pharo-Chrome@0c07ad by Andrei Chis Depend on ZincHTTPComponentsWebSocket feenkcom/lepiter@a668cd by Andrei Chis Merge 92fcf1d6b0c53948360273cdb1ce1aedb4e32f6f feenkcom/lepiter@e6aea1 by Andrei Chis Explicitly convert a path segment to a string to avoid the issue in [svenvc/zinc#63] feenkcom/lepiter@92fcf1 by Alistair Grant LeDatabase: construct attachment paths in a platform independent way Issue: feenkcom/lepiter#1 6da451 by Andrei Chiș Enable local loading using GtRlProjectsLoader
Also, Andrei, a URL that ends with a slash is fundamentally different from one that does not. See ZnUrl>>#isDirectoryPath Maybe #pathSegments exposes a bit too much about the internal implementation. From this perspective, #path might be a better accessor. What is it that you want to do ? |
thanks @svenvc and @noha for the details. I though there was a reason but I did not find that commit. The code that failed in our case was something like below. On a url that has four segments we were checking if the fourth segment was a number, to validate a url like
Now I'll check explicitly for |
Hello @svenvc and @noha. According to the grammar, a segment can not contain slash
According to RFC, the url from your example should be parsed so that it contains two path segments: Here are test cases that exemplify this behavior: Have you considered implementing a separate RFC conform URL parser (with AST nodes), having that there is a grammar available? ### References |
Hi Andrei, I would like to keep this issue open. I am not saying that I want to change the current implementation, but you do have a point. I reread the RFC you mentioned. It strikes me that maybe we could replace the current $/ marker by an empty segment: this would keep the current design, but might result in a less surprising output of the path segments accessor. But I have to think about this more and hopefully I find the time to test it out. Thanks for the feedback. Sven PS: Yes, a parser based on the official RFC ABNF might also be a good idea, but that you be a separate project first. |
Hi Sven. I opened the issue again. Thanks for looking into this! |
About the idea of “a parser based on the official RFC ABNF”: the PetitParser grammar I gave in issue 100 might serve as a starting point. |
In the current version of Pharo 9 on MacOS (Pharo9.0.0
Build information: Pharo-9.0.0+build.1444.sha.a22a97ca8a50d8c0d470c3d1dde29af0e49a85f3 (64 Bit)), when
pathSegments
is called on a url with an empty path aByteSymbol
is returned.When updating to the latest version of Zinc from this repository, this behaviour changes. A character is returned instead.
We are not sure if this change was on purpose?
Also if there is a path segment then we get a
ByteString
:So one cannot assume
pathSegments
returns a collection of Strings.The text was updated successfully, but these errors were encountered: