From 8e291101329aa5bb688b23c153fbc83affebef21 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Wed, 17 Apr 2019 18:46:59 +0200
Subject: Fixed strange behaviour with directory upload in firefox (probably)

Co-authored-by: LarsVomMars <lars@kroenner.eu>
---
 src/main/resources/js/files.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js
index baed543..1247ed1 100644
--- a/src/main/resources/js/files.js
+++ b/src/main/resources/js/files.js
@@ -48,9 +48,12 @@ drop.addEventListener('drop', e => {
                 });
             } else {
                 subItem.file(subFile => {
-                    // TODO: Add support for nested directory upload with more than 1 layer
+                    // TODO: Add support for nested directory upload with more than 1 layer - via webkitRelativePath on firefox?
                     formData.append("file", subFile);
-                    request.open("POST", `/upload/${path}/${file.name}`);
+                    console.log(subFile);
+                    console.log(file);
+                    if (subFile.webkitRelativePath === "") request.open("POST", `/upload/${path}/${file.name}`);
+                    else request.open("POST", `/upload/${path}`);
                     request.send(formData);
                 })
             }
-- 
cgit v1.2.3