Auto remove the redundant trailing slash when set directory path on VentoyPlugson page.

This commit is contained in:
longpanda 2022-06-27 19:42:18 +08:00
parent 24b05c0345
commit 598af7f45c
2 changed files with 10 additions and 3 deletions

View file

@ -2,6 +2,13 @@
function ventoy_replace_slash(str) {
var str1 = str.replace(/\\/g, '/');
var str2 = str1.replace(/\/\//g, '/');
if (str2 && str2.length > 0) {
if (str2.substr(-1) === "/") {
return str2.substr(0, str2.length - 1);
}
}
return str2;
}