Marino Faggiana 6 жил өмнө
parent
commit
b734f04a42

+ 6 - 2
iOSClient/Networking/OCNetworking.m

@@ -188,7 +188,6 @@
         if(contentLength) {
         if(contentLength) {
             totalUnitCount = (int64_t) [contentLength longLongValue];
             totalUnitCount = (int64_t) [contentLength longLongValue];
         }
         }
-        NSString *etag = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-ETag"]];
         NSString *dateString = [fields objectForKey:@"Date"];
         NSString *dateString = [fields objectForKey:@"Date"];
         if (dateString) {
         if (dateString) {
             if (![dateFormatter getObjectValue:&date forString:dateString range:nil error:&error]) {
             if (![dateFormatter getObjectValue:&date forString:dateString range:nil error:&error]) {
@@ -198,7 +197,12 @@
             date = [NSDate date];
             date = [NSDate date];
         }
         }
         
         
-        success(totalUnitCount, etag, date);
+        NSString *etag = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-ETag"]];
+        if (etag == nil) {
+            failure(@"Internal error", k_CCErrorInternalError);
+        } else {
+            success(totalUnitCount, etag, date);
+        }
         
         
     } failureRequest:^(NSURLResponse *response, NSError *error) {
     } failureRequest:^(NSURLResponse *response, NSError *error) {