We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c39c751 commit 61bb42fCopy full SHA for 61bb42f
1 file changed
src/utils/utils.ts
@@ -351,10 +351,10 @@ export const Utils = {
351
removeSlash(url: string, type: "leading" | "trailing" | "both") {
352
let newUrl = url;
353
if (["both", "leading"].includes(type)) {
354
- newUrl.startsWith("/") && (newUrl = newUrl.substring(1));
+ newUrl = newUrl.replace(/^\/+/, "");
355
}
356
if (["both", "trailing"].includes(type)) {
357
- newUrl.endsWith("/") && (newUrl = newUrl.substring(0, newUrl.length - 1));
+ newUrl = newUrl.replace(/\/+$/, "");
358
359
return newUrl;
360
},
0 commit comments