Fix to not add trailing slash to URL with filename
This commit is contained in:
parent
2bd21df762
commit
60cee7fd2f
1 changed files with 5 additions and 2 deletions
|
|
@ -33,8 +33,11 @@ function relativeURLFix() {
|
|||
newHref += `/${path}/${url.href}`;
|
||||
} else if (url.href.startsWith('/')) {
|
||||
// any other relative url starting with /
|
||||
// NOTE: this does strip off serialized queries and fragments
|
||||
newHref += url.pathname.endsWith('/') ? url.pathname : url.pathname + '/';
|
||||
newHref += url.pathname;
|
||||
if (url.pathname.indexOf('.') == -1) {
|
||||
// append trailing slash to resource only if there is no file extension
|
||||
newHref += url.pathname.endsWith('/') ? '' : '/';
|
||||
}
|
||||
newHref += url.hash || '';
|
||||
} else {
|
||||
// leave this URL alone
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue