Commit cd522f52 authored by Max Kellermann's avatar Max Kellermann

fs/Traits: allow base to end with a slash in Relative()

Fixes false negatives: http://foo/dav/example.ogg mismatches http://foo/dav/ .. because StringAfterPrefix() returns just "example.ogg", without trailing slash (it existed, but was eaten already by the base matcher).
parent ca559b1d
......@@ -99,9 +99,16 @@ RelativePathImpl(typename Traits::const_pointer_type base,
return nullptr;
if (*other != 0) {
if (!Traits::IsSeparator(*other))
if (!Traits::IsSeparator(*other)) {
if (*base != 0 && Traits::IsSeparator(other[-1]))
/* "other" has no more slash, but the
matching base ended with a slash:
enough to detect a match */
return other;
/* mismatch */
return nullptr;
}
/* skip remaining path separators */
do {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment