diff options
author | Marvin Borner | 2019-04-19 01:08:21 +0200 |
---|---|---|
committer | Marvin Borner | 2019-04-19 01:08:21 +0200 |
commit | fe97c12731193211caf8652a6fd40e02d0d429b4 (patch) | |
tree | c6cb62b0d625c94b15a6c888693599c6fbef8568 /src/main/resources/js | |
parent | 0e7c4ef365d21e1e283c814124dba318a7772603 (diff) |
Added sharing of directories
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/main/resources/js')
-rw-r--r-- | src/main/resources/js/files.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js index 523df0d..6016ba0 100644 --- a/src/main/resources/js/files.js +++ b/src/main/resources/js/files.js @@ -66,7 +66,7 @@ drop.addEventListener('drop', e => { iterateFiles(item); } else { formData.append("file", file); - request.open("POST", `/upload/${path}`); + request.open("POST", `/upload/${path}`, true); request.send(formData); } } @@ -167,8 +167,9 @@ function setListeners() { const request = new XMLHttpRequest(); const parent = e.target.closest("tr"); const fileName = parent.getAttribute("data-href") || parent.getAttribute("data-path"); + const type = fileName.endsWith('/') ? 'dir' : 'file'; - request.open("POST", `/share/${path}/${fileName}`); + request.open("POST", `/share/${path}/${fileName}?type=${type}`, true); request.onload = () => { if (request.readyState === 4) { if (request.status === 200) { // TODO: fix clipboard in Firefox |