Commit 5776d98a authored by Diego Molteni's avatar Diego Molteni Committed by Sacha Brants
Browse files

fix: check dataset existence on Idempotency evaluation

parent 9401f8e9
This diff is collapsed.
......@@ -131,9 +131,11 @@ export class DatasetHandler {
const alreadyRegisteredDataset = subproject.enforce_key ?
await DatasetDAO.getByKey(journalClient, dataset) :
(await DatasetDAO.get(journalClient, dataset))[0];
if (alreadyRegisteredDataset) {
await Locker.removeWriteLock(writeLockSession, true); // Keep the lock session
return alreadyRegisteredDataset;
}
}
// set gcs URL and LegalTag with the subproject information
dataset.gcsurl = subproject.gcs_bucket + '/' + uuidv4();
......@@ -434,7 +436,7 @@ export class DatasetHandler {
// Check authorizations
if (FeatureFlags.isEnabled(Feature.AUTHORIZATION)) {
if(wid.startsWith('W')) {
if (wid.startsWith('W')) {
await Auth.isWriteAuthorized(req.headers.authorization,
subproject.acls.admins,
tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]);
......@@ -527,7 +529,7 @@ export class DatasetHandler {
}
await Auth.isWriteAuthorized(req.headers.authorization,
authGroups,tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]);
authGroups, tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]);
}
// patch datasetOUT with datasetIN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment