fix rename when file in subdir

This commit is contained in:
matth@ultra 2024-09-02 15:21:42 +02:00
parent b9281ff02f
commit f35f2cc6d5

View File

@ -4,6 +4,7 @@ const audioExtensions =['mp3', 'ogg', 'wav', 'flac'];
const invalidFileNameCharsRe =/[\\/\|:\*\?"<>]/; // dont allow \/|:*?<> const invalidFileNameCharsRe =/[\\/\|:\*\?"<>]/; // dont allow \/|:*?<>
const invalidFileNameChars = "\\/|:*?<>"; const invalidFileNameChars = "\\/|:*?<>";
const splitFilePathRe = /(.*\/)?([^/]*?)(\.[^/.]+)?$/;
const mappings = new Map(JSON.parse(localStorage.getItem('mappings')) || []); const mappings = new Map(JSON.parse(localStorage.getItem('mappings')) || []);
let statusLine = document.getElementById('status'); let statusLine = document.getElementById('status');
@ -194,6 +195,7 @@ function setCurrentFile() {
} }
// else if (currentFileIdx < fileList.length) { // else if (currentFileIdx < fileList.length) {
// } // }
// st:
else if (currentFileIdx >= fileList.length) { else if (currentFileIdx >= fileList.length) {
currentFileIdx = fileList.length - 1; currentFileIdx = fileList.length - 1;
} }
@ -208,7 +210,7 @@ function setCurrentFile() {
} }
// set filename in input field // set filename in input field
const fileNameNoExt = currentFile.replace(/\.[^/.]+$/, ""); const fileNameNoExt = currentFile.replace(splitFilePathRe, "$2");
document.getElementById('filename').value = fileNameNoExt; document.getElementById('filename').value = fileNameNoExt;
renderCurrentFile(); renderCurrentFile();