aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Storage
diff options
context:
space:
mode:
authorGravatar Sebastian Schmidt <mrschmidt@google.com>2017-11-09 14:40:36 -0800
committerGravatar Sebastian Schmidt <mrschmidt@google.com>2017-11-09 17:51:31 -0800
commitb757a21418028d797a632684c529e5714d24c799 (patch)
treebfd1735a2ab595ccfcb2d14584c5b25d5f3612be /Firebase/Storage
parent110f0edf9d25887984fcdf12becb11a4661ad637 (diff)
Adding the md5 hash to FIRStorageMetadata
Diffstat (limited to 'Firebase/Storage')
-rw-r--r--Firebase/Storage/FIRStorageConstants.m1
-rw-r--r--Firebase/Storage/FIRStorageMetadata.m5
-rw-r--r--Firebase/Storage/Private/FIRStorageConstants_Private.h1
-rw-r--r--Firebase/Storage/Public/FIRStorageMetadata.h5
4 files changed, 12 insertions, 0 deletions
diff --git a/Firebase/Storage/FIRStorageConstants.m b/Firebase/Storage/FIRStorageConstants.m
index 2018b42..3136807 100644
--- a/Firebase/Storage/FIRStorageConstants.m
+++ b/Firebase/Storage/FIRStorageConstants.m
@@ -63,6 +63,7 @@ NSString *const kFIRStorageMetadataTimeCreated = @"timeCreated";
NSString *const kFIRStorageMetadataUpdated = @"updated";
NSString *const kFIRStorageMetadataName = @"name";
NSString *const kFIRStorageMetadataDownloadTokens = @"downloadTokens";
+NSString *const kFIRStorageMetadataMd5Hash = @"md5Hash";
// TODO: add notification support
NSString *const kFIRStorageTaskStatusResumeNotification =
diff --git a/Firebase/Storage/FIRStorageMetadata.m b/Firebase/Storage/FIRStorageMetadata.m
index d2b8277..34ac86c 100644
--- a/Firebase/Storage/FIRStorageMetadata.m
+++ b/Firebase/Storage/FIRStorageMetadata.m
@@ -46,6 +46,7 @@
_metageneration = [dictionary[kFIRStorageMetadataMetageneration] longLongValue];
_timeCreated = [self dateFromRFC3339String:dictionary[kFIRStorageMetadataTimeCreated]];
_updated = [self dateFromRFC3339String:dictionary[kFIRStorageMetadataUpdated]];
+ _md5Hash = dictionary[kFIRStorageMetadataMd5Hash];
// GCS "name" is our path, our "name" is just the last path component of the path
_path = dictionary[kFIRStorageMetadataName];
_name = [_path lastPathComponent];
@@ -137,6 +138,10 @@
metadataDictionary[kFIRStorageMetadataContentType] = _contentType;
}
+ if (_md5Hash) {
+ metadataDictionary[kFIRStorageMetadataMd5Hash] = _md5Hash;
+ }
+
if (_customMetadata) {
metadataDictionary[kFIRStorageMetadataCustomMetadata] = _customMetadata;
}
diff --git a/Firebase/Storage/Private/FIRStorageConstants_Private.h b/Firebase/Storage/Private/FIRStorageConstants_Private.h
index 50addb1..498c687 100644
--- a/Firebase/Storage/Private/FIRStorageConstants_Private.h
+++ b/Firebase/Storage/Private/FIRStorageConstants_Private.h
@@ -62,6 +62,7 @@ FOUNDATION_EXPORT NSString *const kFIRStorageMetadataTimeCreated;
FOUNDATION_EXPORT NSString *const kFIRStorageMetadataUpdated;
FOUNDATION_EXPORT NSString *const kFIRStorageMetadataName;
FOUNDATION_EXPORT NSString *const kFIRStorageMetadataDownloadTokens;
+FOUNDATION_EXPORT NSString *const kFIRStorageMetadataMd5Hash;
FOUNDATION_EXPORT NSString *const kFIRStorageInvalidDataFormat;
FOUNDATION_EXPORT NSString *const kFIRStorageInvalidObserverStatus;
diff --git a/Firebase/Storage/Public/FIRStorageMetadata.h b/Firebase/Storage/Public/FIRStorageMetadata.h
index 61d95ca..e6e001f 100644
--- a/Firebase/Storage/Public/FIRStorageMetadata.h
+++ b/Firebase/Storage/Public/FIRStorageMetadata.h
@@ -63,6 +63,11 @@ FIR_SWIFT_NAME(StorageMetadata)
@property(copy, nonatomic, nullable) NSString *contentType;
/**
+ * MD5 hash of the data; encoded using base64.
+ */
+@property(copy, nonatomic, nullable, readonly) NSString *md5Hash;
+
+/**
* The content generation of this object. Used for object versioning.
*/
@property(readonly) int64_t generation;