Deploy drhider / validate (push) Canceled after 0s
- Update upload/ module to v0.2.2 with modular Layer 1 (FilePicker) and Layer 2 (Streaming transit upload) - Replace legacy manual file table in site/templates/index.html with FilePicker.initFilePicker - Wire uploadViaVM with per-file status updates and abort signal support - Add dist bundles to dist/ and site/static/dist/ with routes in site/routes/main_bp.py - Add test_hardening.py and test_safe_name.py from upload-platform - Bump version to 0.0.78 in site/app.py - Document integration plan and report in History/upload-integration/
17 lines
867 B
JavaScript
17 lines
867 B
JavaScript
/**
|
|
* Добавляет префикс корневой папки к каждому пути дерева.
|
|
*
|
|
* @param {{path: string, file?: File, children: Array}} root Узел дерева.
|
|
* @param {string} prefix Путь выбранной папки, в которую попал узел.
|
|
* @returns {object} Тот же узел после изменения путей.
|
|
*
|
|
* Для leaf-файлов создаётся новый File с тем же базовым именем; логический путь
|
|
* хранится отдельно в узле дерева.
|
|
*/
|
|
export function rebaseTree(root, prefix) {
|
|
root.path = `${prefix}/${root.path}`;
|
|
if (root.file) root.file = new File([root.file], root.file.name, { lastModified: root.file.lastModified });
|
|
root.children.forEach((child) => rebaseTree(child, prefix));
|
|
return root;
|
|
}
|