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