Simplify place-id/apiKey validation logic per review feedback

This commit is contained in:
copilot-swe-agent[bot] 2026-07-02 15:56:45 +00:00 committed by GitHub
parent a1ee29a1b8
commit 689f2b5a6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,13 +103,9 @@ router.post('/places', (req, res) => {
return res.status(403).json({ success: false, message: "Only admins can set a custom place id or API key" }); return res.status(403).json({ success: false, message: "Only admins can set a custom place id or API key" });
} }
if (!canSetCustomValues) { // If we reach here, either the caller is an admin, or both id and apiKey were already falsy.
id = ''; id = id ? String(id).trim() : '';
apiKey = ''; apiKey = apiKey ? String(apiKey).trim() : '';
} else {
id = id ? String(id).trim() : '';
apiKey = apiKey ? String(apiKey).trim() : '';
}
if (!id) id = generatePlaceId(); if (!id) id = generatePlaceId();
if (!apiKey) apiKey = generateApiKey(); if (!apiKey) apiKey = generateApiKey();