Fix sanitizeURL (#599)

This commit is contained in:
peolic 2020-06-10 03:13:57 +03:00 committed by GitHub
parent bd5ee9ba6b
commit ef8cba804f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,11 +119,11 @@ const sanitiseURL = (url?: string, siteURL?: URL) => {
if (siteURL) {
// if url starts with the site host, then prepend the protocol
if (url.startsWith(siteURL.host)) {
return siteURL.protocol + url;
return `${siteURL.protocol}//${url}`;
}
// otherwise, construct the url from the protocol, host and passed url
return `${siteURL.protocol}${siteURL.host}/${url}`;
return `${siteURL.protocol}//${siteURL.host}/${url}`;
}
// just prepend the protocol - assume https