Changeset 8009


Ignore:
Timestamp:
Aug 13, 2021, 7:46:28 AM (10 months ago)
Author:
Nicklas Nordborg
Message:

References #2258: Drag and drop file upload

Ignoring hidden files and folders (name is starting with a '.') unless the hidden item has been explicitely selected as a top-level file or folder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.19-stable/www/filemanager/upload/drag_drop_upload.js

    r8008 r8009  
    109109    var ff = filesAndFolders.splice(0, 1)[0];
    110110    currentFolder = ff.subfolder || '';
    111     if (ff.isFile)
    112     {
    113       // Get the file item as a 'File' object (its an async operation)
    114       ff.file(upload.gotFile);
    115     }
    116     else if (ff.isDirectory)
    117     {
    118       // Save the currentFolder for later use in 'upload.gotFolder'
    119       currentFolder += ff.name+'/';
    120       // Read files and subfolders (its an async operation)
    121       currentDirectoryReader = ff.createReader();
    122       currentDirectoryReader.readEntries(upload.gotFolder);
    123     }
    124     else
    125     {
    126       // Process next entry
    127       upload.processFilesAndFolders();
    128     }
     111    // Ignore files/directories inside subfolders starting with '.' unless
     112    // the top folder that was selected is also hidden
     113    var ignore = ff.name.charAt(0)=='.' && (currentFolder.length > 0 && currentFolder.charAt(0)!='.');
     114    if (!ignore)
     115    {
     116      if (ff.isFile)
     117      {
     118        // Get the file item as a 'File' object (its an async operation)
     119        ff.file(upload.gotFile);
     120        return;
     121      }
     122      else if (ff.isDirectory)
     123      {
     124        // Save the currentFolder for later use in 'upload.gotFolder'
     125        currentFolder += ff.name+'/';
     126        // Read files and subfolders (its an async operation)
     127        currentDirectoryReader = ff.createReader();
     128        currentDirectoryReader.readEntries(upload.gotFolder);
     129        return;
     130      }
     131    }
     132   
     133    // Process next entry
     134    upload.processFilesAndFolders();
    129135  }
    130136 
Note: See TracChangeset for help on using the changeset viewer.