if Pruefung fuer Datei Endung gefixt

This commit is contained in:
santa
2025-11-16 14:46:19 +01:00
parent 2edc7f8351
commit 9441699561
2 changed files with 58 additions and 46 deletions
+9 -3
View File
@@ -16,15 +16,21 @@ uploadContainer.addEventListener("drop", (e) => {
e.preventDefault() e.preventDefault()
const files = e.dataTransfer.files const files = e.dataTransfer.files
const filePath = window.explorer.onFileDrop(files[0]) const filePath = window.explorer.onFileDrop(files[0])
var holdy = filePath + "";
if(holdy.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
console.log(filePath)
var holdy = String(filePath);
const lower = holdy.toLowerCase();
const validExt = [".mp4", ".mov", ".avi", ".mkv"];
if(validExt.some(ext => lower.endsWith(ext))){
console.log(filePath);
const files1 = e.dataTransfer.files; const files1 = e.dataTransfer.files;
handleFiles(files1); handleFiles(files1);
}else{
console.log('Video format invalid!');
} }
} catch (error) { } catch (error) {
console.log("Error in renderer.js with the listerner for the drop function"); console.log("Error in renderer.js with the listerner for the drop function");
console.log(error);
} }
+8 -2
View File
@@ -24,9 +24,15 @@ function checkBoxes() {
if (isChecked) { if (isChecked) {
//Code to submit the video //Code to submit the video
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]); var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"}) const lower = pathTest.toLowerCase();
const validExt = [".mp4", ".mov", ".avi", ".mkv"];
if(validExt.some(ext => lower.endsWith(ext))){
window.extractor.extract({ inputVideoPath: pathTest, outputType: "wav" });
} }
} else { } else {
//language only english at the moment //language only english at the moment
alert('Please select at least one document type.'); alert('Please select at least one document type.');