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

This commit is contained in:
Pieter Vander Vennet 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) { for (const dontLike of blacklistedTrackingParams) {
url.searchParams.delete(dontLike) 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) { } catch (e) {
console.error(e) console.error(e)
return undefined; return undefined;