Fix
This commit is contained in:
@@ -649,8 +649,12 @@ router.post('/exports/:filename/restore', async (req, res, next) => {
|
||||
for (const subdir of ['logos', 'icons']) {
|
||||
const dir = path.join(dataDir, subdir);
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
// Vidage du dossier existant
|
||||
for (const f of fs.readdirSync(dir)) fs.unlinkSync(path.join(dir, f));
|
||||
// Vidage du dossier existant (fichiers et sous-dossiers)
|
||||
for (const f of fs.readdirSync(dir)) {
|
||||
const fp = path.join(dir, f);
|
||||
if (fs.statSync(fp).isDirectory()) fs.rmSync(fp, { recursive: true });
|
||||
else fs.unlinkSync(fp);
|
||||
}
|
||||
// Écriture des nouveaux fichiers
|
||||
for (const entry of entries.filter(e => e.name.startsWith(`${subdir}/`) && !e.name.endsWith('/'))) {
|
||||
fs.writeFileSync(path.join(dir, path.basename(entry.name)), entry.data);
|
||||
|
||||
Reference in New Issue
Block a user