From 598af7f45c8112321b10da3c38e70468e62ea6a6 Mon Sep 17 00:00:00 2001 From: longpanda Date: Mon, 27 Jun 2022 19:42:18 +0800 Subject: [PATCH] Auto remove the redundant trailing slash when set directory path on VentoyPlugson page. --- Plugson/www/index.html | 6 +++--- Plugson/www/static/js/vtoy.js | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Plugson/www/index.html b/Plugson/www/index.html index e6f5fd1d..49ce8e6b 100644 --- a/Plugson/www/index.html +++ b/Plugson/www/index.html @@ -743,10 +743,10 @@ - + - - + + diff --git a/Plugson/www/static/js/vtoy.js b/Plugson/www/static/js/vtoy.js index 283bf078..68719254 100644 --- a/Plugson/www/static/js/vtoy.js +++ b/Plugson/www/static/js/vtoy.js @@ -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; }