From b7eed67f2f79519faada367960146b217e2c062f Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 31 May 2018 23:36:00 -0400 Subject: [PATCH] Warn users about uploading folders not working and resolve #599 (#1181) --- .../pterodactyl/js/frontend/files/upload.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/public/themes/pterodactyl/js/frontend/files/upload.js b/public/themes/pterodactyl/js/frontend/files/upload.js index 2bb1dd8c7..873fbf636 100644 --- a/public/themes/pterodactyl/js/frontend/files/upload.js +++ b/public/themes/pterodactyl/js/frontend/files/upload.js @@ -61,6 +61,18 @@ event.preventDefault(); }, false); + window.foldersDetectedInDrag = function (event) { + var folderDetected = false; + var files = event.dataTransfer.files; + for (var i = 0, f; f = files[i]; i++) { + if (!f.type && f.size === 0) { + return true; + } + } + + return folderDetected; + }; + var dropCounter = 0; $('#load_files').bind({ dragenter: function (event) { @@ -75,6 +87,15 @@ } }, drop: function (event) { + if (window.foldersDetectedInDrag(event.originalEvent)) { + $.notify({ + message: 'Folder uploads are not supported. Please use SFTP to upload whole directories.', + }, { + type: 'warning', + delay: 0 + }); + } + dropCounter = 0; $(this).removeClass('hasFileHover'); }