Skip to content

Commit

Permalink
fix condition
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrindt committed Jan 2, 2025
1 parent 77a8824 commit 12a00e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/routes/api/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ function encryptBucketCredential(obj, storedCredentials = {}) {
assert(secret_access_key, 'invalid aws S3 bucket credential: secret_access_key is required');
assert(name, 'invalid aws bucket name: name is required');
assert(region, 'invalid aws bucket region: region is required');
if (isObscureKey(storedCredentials && obj.bucket_credential)) {
if (isObscureKey(obj.bucket_credential) && storedCredentials) {
secret_access_key = storedCredentials.secret_access_key;
}
const awsData = JSON.stringify({vendor, region, name, access_key_id,
Expand All @@ -677,7 +677,7 @@ function encryptBucketCredential(obj, storedCredentials = {}) {
assert(secret_access_key, 'invalid aws S3 bucket credential: secret_access_key is required');
assert(name, 'invalid aws bucket name: name is required');
assert(endpoint, 'invalid endpoint uri: endpoint is required');
if (isObscureKey(storedCredentials && obj.bucket_credential)) {
if (isObscureKey(obj.bucket_credential) && storedCredentials) {
secret_access_key = storedCredentials.secret_access_key;
}
const s3Data = JSON.stringify({vendor, endpoint, name, access_key_id,
Expand All @@ -686,7 +686,7 @@ function encryptBucketCredential(obj, storedCredentials = {}) {
break;
case 'google':
assert(service_key, 'invalid google cloud storage credential: service_key is required');
if (isObscureKey(storedCredentials && obj.bucket_credential)) {
if (isObscureKey(obj.bucket_credential) && storedCredentials) {
service_key = storedCredentials.service_key;
}
const googleData = JSON.stringify({vendor, name, service_key, tags});
Expand All @@ -695,7 +695,7 @@ function encryptBucketCredential(obj, storedCredentials = {}) {
case 'azure':
assert(name, 'invalid azure container name: name is required');
assert(connection_string, 'invalid azure cloud storage credential: connection_string is required');
if (isObscureKey(storedCredentials && obj.bucket_credential)) {
if (isObscureKey(obj.bucket_credential) && storedCredentials) {
connection_string = storedCredentials.connection_string;
}
const azureData = JSON.stringify({vendor, name, connection_string, tags});
Expand Down

0 comments on commit 12a00e8

Please sign in to comment.