File tree Expand file tree Collapse file tree 4 files changed +35
-5
lines changed Expand file tree Collapse file tree 4 files changed +35
-5
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.8.18
2
+ - Fix bug in ` Bucket.updateMetadata ` such that ` acl: null ` is allowed.
3
+ Since, this is the only valid value for buckets with uniform access policies.
4
+
1
5
## 0.8.17
2
6
- Fix bug in ` ObjectMetadata.replace ` where ` contentEncoding ` overwrote
3
7
` contentDisposition ` and ` contentLanguage ` .
Original file line number Diff line number Diff line change @@ -286,13 +286,13 @@ class _BucketImpl implements Bucket {
286
286
// TODO: support other ObjectMetadata implementations?
287
287
var md = metadata as _ObjectMetadata ;
288
288
var object = md._object;
289
- if (md._object.acl == null && _defaultObjectAcl == null ) {
290
- throw ArgumentError ('ACL is required for update' );
291
- }
292
289
if (md.contentType == null ) {
293
290
throw ArgumentError ('Content-Type is required for update' );
294
291
}
295
- md._object.acl ?? = _defaultObjectAcl! ._toObjectAccessControlList ();
292
+ // If no ACL is passed use the default (if any).
293
+ if (object.acl == null && _defaultObjectAcl != null ) {
294
+ object.acl = _defaultObjectAcl! ._toObjectAccessControlList ();
295
+ }
296
296
return _api.objects.update (object, bucketName, objectName);
297
297
}
298
298
Original file line number Diff line number Diff line change 1
1
name : gcloud
2
- version : 0.8.17
2
+ version : 0.8.18
3
3
description : >-
4
4
High level idiomatic Dart API for Google Cloud Storage, Pub-Sub and Datastore.
5
5
repository : https://github.com/dart-lang/labs/tree/main/pkgs/gcloud
Original file line number Diff line number Diff line change @@ -341,5 +341,31 @@ void main() {
341
341
], (Function f) => f ().then (expectAsync1 ((_) {})));
342
342
});
343
343
});
344
+
345
+ test ('update-metadata' , () {
346
+ return withTestBucket ((Bucket bucket) async {
347
+ await bucket.writeBytes (
348
+ 'test-m' ,
349
+ metadata: ObjectMetadata (
350
+ contentType: 'application/test-1' ,
351
+ ),
352
+ [1 , 2 , 3 ],
353
+ );
354
+
355
+ final info = await bucket.info ('test-m' );
356
+ expect (info.metadata.contentType, 'application/test-1' );
357
+
358
+ await bucket.updateMetadata (
359
+ 'test-m' ,
360
+ ObjectMetadata (
361
+ contentType: 'application/test-2' ,
362
+ ));
363
+
364
+ final info2 = await bucket.info ('test-m' );
365
+ expect (info2.metadata.contentType, 'application/test-2' );
366
+
367
+ await bucket.delete ('test-m' );
368
+ });
369
+ });
344
370
});
345
371
}
You can’t perform that action at this time.
0 commit comments