-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Replace multiple contiguous forward-slash characters with a single one #1396
Conversation
…e, so that naive functions such as split_path don't end up with empty substrings in their pathnames
Looks good to me. |
Even after applying this patch,
so it doesn't seem to fix the real problem. Anyway, paths w/ multiple slashes are valid. |
Right, this was only to deal with |
Actually, on second thought, we could just use |
Except..... |
Found |
Another way to go would be to create a |
I should have added: the advantage of this route is that rather than building something, and then checking it for problems and recreating if necessary, you just get it right the first time. |
I think |
split can also be told not to include empty tokens.
|
You have to be careful with that and leading slashes though. |
@timholy: We can't rely on it being right the first time, because users can If we want to take in arbitrary strings, though, we need to always treat
|
@staticfloat , good points, carry on... |
@StefanKarpinski, @JeffBezanson: What do you think about creating a |
I don't like it that much, since it strikes me as basically replacing |
I agree with your points, but I see a few pros that may still outweigh the cons:
|
The "safety" provided by a new type is still a consenting-adults thing until #13. (Thus adding this to the list of things to maybe look at again when it's resolved.) |
@pao: Are you referring to the lack of an
Where every operation performed inside FilePath is passed through |
This also might be a premature optimization. It may not matter to repeatedly normalize paths. |
Fair enough. Let's just roll with what we have, then, and leave this for a rainy day when issues like this actually start to pop up. |
My point was that you could directly access the field after the path was constructed,which subverts the work done by the constructor. Doesn't matter in light of current decisions, though. |
The split_path bug was fixed in 5b5824d, so i'm going to close this. |
So that naive functions such as split_path don't end up with empty substrings in their pathnames
I'm not sure which other functions this should be a part of, this was to address #1387