-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
When recursively re-building the hierarchical structure of the uploaded files from the Map, we need to test if the current key is a file or a folder. For now, the way of testing is by checking wether the key has a dot in its name (for the file extension) ; a folder containing a dot in its name will cause trouble. Need to find a better way to test the type of the key.
Using typeof won't work, because it returns object in both cases (File and Map are objects).
pwa-playlist-generator/app/js/app.js
Lines 98 to 123 in f8523cf
// | |
function folderRecursiveBuild(currentFolder, parentFolder=zipBuilder) | |
{ | |
let htmlTree = ''; | |
for (let [k, v] of currentFolder) | |
{ | |
// Audio file | |
//FIXME: to improve ; cannot have a folder with a . | |
if (k.includes('.')) | |
{ | |
parentFolder.file(v.name, v); | |
htmlTree += '<li><a href="' + v.webkitRelativePath + '" class="audio-src">' + v.name + '</a><a href="' + v.webkitRelativePath + '" class="cache-audio">Download</a></li>'; | |
} | |
// Folder | |
else | |
{ | |
htmlTree += '<ul><li>' + k + '</li>'; | |
htmlTree += folderRecursiveBuild(v, parentFolder.folder(k)); | |
htmlTree += '</ul>'; | |
} | |
} | |
return htmlTree; | |
} |
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed