@react-native-firebase/storage 14.11.1 → 14.11.2
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [14.11.2](https://github.com/invertase/react-native-firebase/compare/v14.11.1...v14.11.2) (2022-09-17)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **storage, ios:** correct storage metadata update / delete ([2dcb079](https://github.com/invertase/react-native-firebase/commit/2dcb0790c1812a33100cceea9dcb407d6a64cb87))
|
11
|
+
- **storage, ios:** surface underlying reason for unknown errors if possible ([6cd53ea](https://github.com/invertase/react-native-firebase/commit/6cd53eaca16ef52c52a28a7b209a7c8313fef08b))
|
12
|
+
|
6
13
|
## [14.11.1](https://github.com/invertase/react-native-firebase/compare/v14.11.0...v14.11.1) (2022-06-17)
|
7
14
|
|
8
15
|
**Note:** Version bump only for package @react-native-firebase/storage
|
@@ -56,7 +56,8 @@
|
|
56
56
|
|
57
57
|
+ (NSString *)getTaskStatus:(FIRStorageTaskStatus)status;
|
58
58
|
|
59
|
-
+ (FIRStorageMetadata *)buildMetadataFromMap:(NSDictionary *)metadata
|
59
|
+
+ (FIRStorageMetadata *)buildMetadataFromMap:(NSDictionary *)metadata
|
60
|
+
existingMetadata:(FIRStorageMetadata *)existingMetadata;
|
60
61
|
|
61
62
|
+ (NSArray *)getErrorCodeMessage:(NSError *)error;
|
62
63
|
|
@@ -392,9 +392,64 @@
|
|
392
392
|
}
|
393
393
|
}
|
394
394
|
|
395
|
-
+ (FIRStorageMetadata *)buildMetadataFromMap:(NSDictionary *)metadata
|
396
|
-
|
397
|
-
|
395
|
+
+ (FIRStorageMetadata *)buildMetadataFromMap:(NSDictionary *)metadata
|
396
|
+
existingMetadata:(nullable FIRStorageMetadata *)existingMetadata {
|
397
|
+
// If an existing metadata was passed in, modify it with our map, otherwise init a fresh copy
|
398
|
+
FIRStorageMetadata *storageMetadata = existingMetadata;
|
399
|
+
if (storageMetadata == nil) {
|
400
|
+
storageMetadata = [[FIRStorageMetadata alloc] init];
|
401
|
+
}
|
402
|
+
|
403
|
+
if (metadata[@"cacheControl"] == [NSNull null]) {
|
404
|
+
storageMetadata.cacheControl = nil;
|
405
|
+
} else {
|
406
|
+
storageMetadata.cacheControl = metadata[@"cacheControl"];
|
407
|
+
}
|
408
|
+
|
409
|
+
if (metadata[@"contentLanguage"] == [NSNull null]) {
|
410
|
+
storageMetadata.contentLanguage = nil;
|
411
|
+
} else {
|
412
|
+
storageMetadata.contentLanguage = metadata[@"contentLanguage"];
|
413
|
+
}
|
414
|
+
|
415
|
+
if (metadata[@"contentEncoding"] == [NSNull null]) {
|
416
|
+
storageMetadata.contentEncoding = nil;
|
417
|
+
} else {
|
418
|
+
storageMetadata.contentEncoding = metadata[@"contentEncoding"];
|
419
|
+
}
|
420
|
+
|
421
|
+
if (metadata[@"contentDisposition"] == [NSNull null]) {
|
422
|
+
storageMetadata.contentDisposition = nil;
|
423
|
+
} else {
|
424
|
+
storageMetadata.contentDisposition = metadata[@"contentDisposition"];
|
425
|
+
}
|
426
|
+
|
427
|
+
if (metadata[@"contentType"] == [NSNull null]) {
|
428
|
+
storageMetadata.contentType = nil;
|
429
|
+
} else {
|
430
|
+
storageMetadata.contentType = metadata[@"contentType"];
|
431
|
+
}
|
432
|
+
|
433
|
+
if (metadata[@"customMetadata"] == [NSNull null]) {
|
434
|
+
storageMetadata.customMetadata = @{};
|
435
|
+
} else {
|
436
|
+
NSMutableDictionary *customMetadata = [metadata[@"customMetadata"] mutableCopy];
|
437
|
+
for (NSString *key in customMetadata.allKeys) {
|
438
|
+
if (customMetadata[key] == [NSNull null] || customMetadata[key] == nil) {
|
439
|
+
[customMetadata removeObjectForKey:key];
|
440
|
+
}
|
441
|
+
}
|
442
|
+
storageMetadata.customMetadata = customMetadata;
|
443
|
+
}
|
444
|
+
|
445
|
+
// md5hash may be settable but is not update-able, so just test for existence and carry it in
|
446
|
+
// FIXME this will need a fix related to
|
447
|
+
// https://github.com/firebase/firebase-ios-sdk/issues/9849#issuecomment-1159292592 if
|
448
|
+
// (metadata[@"md5hash"]) {
|
449
|
+
// NSLog(@"STORAGE md5hash was set");
|
450
|
+
// storageMetadata.md5Hash = metadata[@"md5hash"];
|
451
|
+
// }
|
452
|
+
|
398
453
|
return storageMetadata;
|
399
454
|
}
|
400
455
|
|
@@ -417,7 +472,13 @@
|
|
417
472
|
code = @"invalid-device-file-path";
|
418
473
|
message = @"The specified device file path is invalid or is restricted.";
|
419
474
|
} else {
|
420
|
-
|
475
|
+
if (userInfo[@"ResponseBody"]) {
|
476
|
+
message =
|
477
|
+
[NSString stringWithFormat:@"An unknown error has occurred. (underlying reason '%@')",
|
478
|
+
userInfo[@"ResponseBody"]];
|
479
|
+
} else {
|
480
|
+
message = @"An unknown error has occurred.";
|
481
|
+
}
|
421
482
|
}
|
422
483
|
break;
|
423
484
|
case FIRStorageErrorCodeObjectNotFound:
|
@@ -143,17 +143,26 @@ RCT_EXPORT_METHOD(updateMetadata
|
|
143
143
|
: (RCTPromiseResolveBlock)resolve
|
144
144
|
: (RCTPromiseRejectBlock)reject) {
|
145
145
|
FIRStorageReference *storageReference = [self getReferenceFromUrl:url app:firebaseApp];
|
146
|
-
FIRStorageMetadata *storageMetadata = [RNFBStorageCommon buildMetadataFromMap:metadata];
|
147
146
|
|
148
|
-
[storageReference
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
147
|
+
[storageReference metadataWithCompletion:^(FIRStorageMetadata *_Nullable fetchedMetadata,
|
148
|
+
NSError *_Nullable error) {
|
149
|
+
if (error != nil) {
|
150
|
+
[self promiseRejectStorageException:reject error:error];
|
151
|
+
} else {
|
152
|
+
FIRStorageMetadata *storageMetadata =
|
153
|
+
[RNFBStorageCommon buildMetadataFromMap:metadata existingMetadata:fetchedMetadata];
|
154
|
+
|
155
|
+
[storageReference updateMetadata:storageMetadata
|
156
|
+
completion:^(FIRStorageMetadata *_Nullable updatedMetadata,
|
157
|
+
NSError *_Nullable error) {
|
158
|
+
if (error != nil) {
|
159
|
+
[self promiseRejectStorageException:reject error:error];
|
160
|
+
} else {
|
161
|
+
resolve([RNFBStorageCommon metadataToDict:updatedMetadata]);
|
162
|
+
}
|
163
|
+
}];
|
164
|
+
}
|
165
|
+
}];
|
157
166
|
}
|
158
167
|
|
159
168
|
/**
|
@@ -391,7 +400,8 @@ RCT_EXPORT_METHOD(putFile
|
|
391
400
|
: (nonnull NSNumber *)taskId
|
392
401
|
: (RCTPromiseResolveBlock)resolve
|
393
402
|
: (RCTPromiseRejectBlock)reject) {
|
394
|
-
FIRStorageMetadata *storageMetadata = [RNFBStorageCommon buildMetadataFromMap:metadata
|
403
|
+
FIRStorageMetadata *storageMetadata = [RNFBStorageCommon buildMetadataFromMap:metadata
|
404
|
+
existingMetadata:nil];
|
395
405
|
FIRStorageReference *storageReference = [self getReferenceFromUrl:url app:firebaseApp];
|
396
406
|
|
397
407
|
[RNFBStorageCommon
|
@@ -462,7 +472,8 @@ RCT_EXPORT_METHOD(putString
|
|
462
472
|
: (nonnull NSNumber *)taskId
|
463
473
|
: (RCTPromiseResolveBlock)resolve
|
464
474
|
: (RCTPromiseRejectBlock)reject) {
|
465
|
-
FIRStorageMetadata *storageMetadata = [RNFBStorageCommon buildMetadataFromMap:metadata
|
475
|
+
FIRStorageMetadata *storageMetadata = [RNFBStorageCommon buildMetadataFromMap:metadata
|
476
|
+
existingMetadata:nil];
|
466
477
|
FIRStorageReference *storageReference = [self getReferenceFromUrl:url app:firebaseApp];
|
467
478
|
|
468
479
|
__block FIRStorageUploadTask *uploadTask;
|
package/lib/utils.js
CHANGED
@@ -88,9 +88,9 @@ export function validateMetadata(metadata, update = true) {
|
|
88
88
|
`firebase.storage.SettableMetadata invalid property '${key}' should be a string or null value.`,
|
89
89
|
);
|
90
90
|
}
|
91
|
-
} else if (!isObject(value)) {
|
91
|
+
} else if (!isObject(value) && !isNull(value)) {
|
92
92
|
throw new Error(
|
93
|
-
'firebase.storage.SettableMetadata.customMetadata must be an object of keys and string values.',
|
93
|
+
'firebase.storage.SettableMetadata.customMetadata must be an object of keys and string values or null value.',
|
94
94
|
);
|
95
95
|
}
|
96
96
|
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '14.11.
|
2
|
+
module.exports = '14.11.2';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/storage",
|
3
|
-
"version": "14.11.
|
3
|
+
"version": "14.11.2",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration with Cloud Storage, providing support to upload and download files directly from your device and from your Firebase Cloud Storage bucket.",
|
6
6
|
"main": "lib/index.js",
|
@@ -29,10 +29,10 @@
|
|
29
29
|
"download"
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
|
-
"@react-native-firebase/app": "14.11.
|
32
|
+
"@react-native-firebase/app": "14.11.2"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "1da8ab19fe93ae1b61c0367e12acf0c999afc06a"
|
38
38
|
}
|