api/api-keys: replace .find() with .some() in allowedServices
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Run tests / check lockfile correctness (push) Waiting to run

& also a little refactor
This commit is contained in:
wukko 2025-06-26 22:32:39 +06:00
parent dce9eb30c1
commit 8feaf5c636
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -80,10 +80,10 @@ const validateKeys = (input) => {
}
if (details.allowedServices) {
const isArray = Array.isArray(details.allowedServices);
if (isArray) {
const invalid_services = details.allowedServices.find(service => !env.allServices.has(service));
if (Array.isArray(details.allowedServices)) {
const invalid_services = details.allowedServices.some(
service => !env.allServices.has(service)
);
if (invalid_services) {
throw "`allowedServices` in details contains an invalid service";
}