Fix: UTF-8 Support für Datei-Umbenennung - Leerzeichen und Umlaute (äöü) jetzt erlaubt
This commit is contained in:
parent
73eada8fd9
commit
c44d9b7f87
1 changed files with 3 additions and 1 deletions
|
|
@ -514,7 +514,9 @@ app.post('/api/admin/sounds/rename', requireAdmin, (req: Request, res: Response)
|
||||||
const src = path.join(SOUNDS_DIR, from);
|
const src = path.join(SOUNDS_DIR, from);
|
||||||
// Ziel nur Name ändern, Endung mp3 sicherstellen
|
// Ziel nur Name ändern, Endung mp3 sicherstellen
|
||||||
const parsed = path.parse(from);
|
const parsed = path.parse(from);
|
||||||
const dstRel = path.join(parsed.dir || '', `${to.replace(/[^a-zA-Z0-9_.\-]/g, '_')}.mp3`);
|
// UTF-8 Zeichen erlauben: Leerzeichen, Umlaute, etc. - nur problematische Zeichen filtern
|
||||||
|
const sanitizedName = to.replace(/[<>:"/\\|?*\x00-\x1f]/g, '_');
|
||||||
|
const dstRel = path.join(parsed.dir || '', `${sanitizedName}.mp3`);
|
||||||
const dst = path.join(SOUNDS_DIR, dstRel);
|
const dst = path.join(SOUNDS_DIR, dstRel);
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(src)) return res.status(404).json({ error: 'Quelle nicht gefunden' });
|
if (!fs.existsSync(src)) return res.status(404).json({ error: 'Quelle nicht gefunden' });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue