fix(restore): accept originals paths in group photos

- validate group_photos.photo_original_path with the same tolerant helper
  as entries, so /uploads/.originals/<file> no longer fails restore with
  "Invalid upload path"
- accept legacy flat values in both photo_original_path columns
- preserve users.avatar in normalizeRestoreData and the restore INSERT
- add selftests for originals paths and avatars
This commit is contained in:
dev
2026-10-21 18:36:01 +03:00
parent 697aac9b87
commit 3439d57485
3 changed files with 26 additions and 10 deletions
+2 -2
View File
@@ -6246,8 +6246,8 @@ app.post('/api/restore', requireAdmin, backupUploadGuard, uploadBackup.single('b
}
for (const x of ndata.users) {
await client.query(
'INSERT INTO users (id, username, password_hash, name, role, is_active, created_at) VALUES ($1,$2,$3,$4,$5,$6,$7)',
[x.id, x.username, x.password_hash, x.name, x.role, x.is_active, x.created_at]
'INSERT INTO users (id, username, password_hash, name, avatar, role, is_active, created_at) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
[x.id, x.username, x.password_hash, x.name, x.avatar, x.role, x.is_active, x.created_at]
);
}
for (const x of (ndata.user_settings || [])) {