Fix _include/media-url.html logic #2648
Open
+72
−22
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.
Type of change
Description
When
baseurlin_config.ymlis not empty, without this fix, it can be prepended more than once, which is incorrect.This fix adds logic to prevent prepending the
baseurlwhen it is already a prefix in the url, but correctly handles cases where it is a prefix, but the url does not follow this prefix with a path/url separator.For example, when
baseurlis set to/blog, but the url starts with/bloggerit is not considered "prefixed" and/blog/ is prepended (resulting in/blog/blogger…, but if the url starts with/blog/it is considered "prefixed" and is not prepended again (keeping/resulting in/blog/…`)A limitation is that if the user supplied a (partial) URL starting with
/blog/and truly intended to produce/blog/blog/, it won't work.Additional context
Fixes #2639, and: