backblaze-b2 icon indicating copy to clipboard operation
backblaze-b2 copied to clipboard

Use b2_authorize_account allowed bucketId as default

Open Klowner opened this issue 5 years ago • 7 comments

Looks like #63 hasn't been touched in a few months, seems like a nice feature to have!

Klowner avatar Nov 24 '19 14:11 Klowner

If you provide/update test coverage for this feature, I'd be on board with the changes.

cbess avatar Nov 24 '19 19:11 cbess

Would you prefer the individual tests be added to each of the API test groups or would a new test suite that just verifies that defaultBucketId is properly merged into all outgoing request bodies as bucketId (when bucketId / bucketName are omitted from options)?

Klowner avatar Nov 24 '19 20:11 Klowner

The latter is fine.

odensc avatar Dec 10 '19 20:12 odensc

@Klowner Any chance this can be merged soon? Looks like a great optimization!

adrw avatar Mar 28 '20 21:03 adrw

@adrw feel like writing some tests? :)

Klowner avatar Apr 08 '20 16:04 Klowner

This has been sitting here over 2 years. When will this be merged?

Having the associated bucketId also helps determine whether a master key or an application key has been used since a master key does not have an association with an individual bucket but an application key can.

For now I'll have to look for another package.

ADumaine avatar Feb 01 '22 00:02 ADumaine

I ended up patching lib/utils.js to get this functionality. I also added bucketName since it is required by downloadFileByName

+  if (authResponse.allowed) {
+        context.defaultBucketId = authResponse.allowed.bucketId || '';
+        context.defaultBucketName = authResponse.allowed.bucketName || '';
+    }

ADumaine avatar Mar 22 '22 18:03 ADumaine