Small usability improvement: don't add the trailing '/' to URLs if they weren't typed

This commit is contained in:
pietervdvn 2021-05-10 23:49:46 +02:00
parent 223fada5b3
commit 03f3045a82

View file

@ -145,7 +145,12 @@ export default class ValidatedTextField {
for (const dontLike of blacklistedTrackingParams) {
url.searchParams.delete(dontLike)
}
return url.toString();
let cleaned = url.toString();
if(cleaned.endsWith("/") && !str.endsWith("/")){
// Do not add a trailing '/' if it wasn't typed originally
cleaned = cleaned.substr(0, cleaned.length - 1)
}
return cleaned;
} catch (e) {
console.error(e)
return undefined;