Fix robust project name resolution in backend
Deploy Bürgerwind / deploy (push) Successful in 16s
Details
Deploy Bürgerwind / deploy (push) Successful in 16s
Details
This commit is contained in:
parent
b5c523ab07
commit
af8ed45f4d
|
|
@ -121,11 +121,11 @@ async function resolveProjectId(client, input) {
|
|||
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
if (uuidRegex.test(input)) return input;
|
||||
|
||||
// Normalisierte Suche (Kleinschreibung, Bindestriche zu Unterstrichen)
|
||||
const normalized = input.toLowerCase().replace(/-/g, '_');
|
||||
// Normalisierte Suche (Kleinschreibung, alle Bindestriche und Unterstriche entfernen)
|
||||
const normalized = input.toLowerCase().replace(/[-_]/g, '');
|
||||
|
||||
const res = await client.query(
|
||||
'SELECT id FROM geodaten.projekte WHERE LOWER(name) = $1 OR LOWER(REPLACE(name, \'-\', \'_\')) = $1',
|
||||
'SELECT id FROM geodaten.projekte WHERE LOWER(REPLACE(REPLACE(name, \'-\', \'\'), \'_\', \'\')) = $1',
|
||||
[normalized]
|
||||
);
|
||||
return res.rows.length > 0 ? res.rows[0].id : null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue