fix path merge with path object #2245
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mojo::Path
's support of merging objects of classMojo::Path
(vs. strings) until now is implemented by object stringification followed by a reparsing using a defaultMojo::Path
object.This approach works fine for merged objects with a character set of UTF-8 as this is also the default character set for
Mojo::Path
objects. It can fail however for other character sets.Instead copy the path parts and the slash attributes from the source to the target object.
The missing tests for merging objects are included using the ISO-8859-15 character set. That way those tests can also function as regression tests. The ISO-8859-15 character set deviates from ISO-8859-1 and in turn from Unicode in that it reassigns code points of less common symbols (code point A4 which is the currency sign in ISO-8859-1/Unicode is replaced by the Euro currency sign e.g.).
Background:
Mojo::URL::to_abs()
e.g. passes path objects toMojo::Path::merge()
in order to merge the path onto the base path today. And can fail in the way outlined above if the path object is not configured to be UTF-8.