mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
d0f8eda937
And reject paths ending in empty segments. The following cases were being parsed incorrectly: - `/` represents the empty path, `~`. This was being parsed into `[~. ~]` - `/x/` is not valid. This was being parsed into `[~.x ~. ~]` This happens because `urs:ab` has no problem parsing the empty string. For some supported cases, like `//x` (`[~. ~.x ~]`), this is actually desired behavior, but it results in trailing empty segments for paths ending in `/`. Here we apply a `+sear` on top of the existing parser, that transform the `/` case to produce `~`, and ensures the absence of a trailing empty segment in all other cases. Note that we change `(more fas urs:ab)` to `(most fas urs:ab)`. Since `urs:ab` parses the empty string, this doesn't actually make a difference, but it does make it more obvious that the `+rear` call will never crash. Alternative approaches I attempted all resulted in much more complicated parser, so the dumb `+sear` seems preferable. We do eat the performance cost of an additional list traversal (in `+rear`) with this change, but that is probably not the end of the world. Fixes #1501. |
||
---|---|---|
.. | ||
vane | ||
arvo.hoon | ||
hoon.hoon | ||
lull.hoon | ||
zuse.hoon |