File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
Commands/CommandRunner/URLRequestConstructor Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,16 @@ + (instancetype)constructorWithDataSource:(id<PFInstallationIdentifierStoreProvi
9999 [request setValue: contentType forHTTPHeaderField: PFHTTPRequestHeaderNameContentType];
100100 }
101101
102- // TODO (nlutsenko): Check for error here.
103- NSNumber *fileSize = [PFInternalUtils fileSizeOfFileAtPath: contentFilePath error: nil ];
104- [request setValue: fileSize.stringValue forHTTPHeaderField: PFHTTPRequestHeaderNameContentLength];
102+ NSURL *fileURL = [NSURL fileURLWithPath: contentFilePath];
103+ NSNumber *fileSize = nil ;
104+ NSError *error = nil ;
105+ [fileURL getResourceValue: &fileSize forKey: NSURLFileSizeKey error: &error];
106+ if (error) {
107+ return [BFTask taskWithError: error];
108+ }
109+ if (fileSize) {
110+ [request setValue: fileSize.stringValue forHTTPHeaderField: PFHTTPRequestHeaderNameContentLength];
111+ }
105112
106113 return request;
107114 }];
Original file line number Diff line number Diff line change 2222+ (NSString *)parseServerURLString ;
2323+ (void )setParseServer : (NSString *)server ;
2424
25- + (NSNumber *)fileSizeOfFileAtPath : (NSString *)filePath error : (NSError **)error ;
26-
2725/* *
2826 Clears system time zone cache, gets the name of the time zone
2927 and caches it. This method is completely thread-safe.
Original file line number Diff line number Diff line change @@ -86,12 +86,6 @@ + (void)safePerformSelector:(SEL)selector withTarget:(id)target object:(id)objec
8686#pragma clang diagnostic pop
8787}
8888
89- + (NSNumber *)fileSizeOfFileAtPath : (NSString *)filePath error : (NSError **)error {
90- NSDictionary *attributes = [[NSFileManager defaultManager ] attributesOfItemAtPath: filePath
91- error: error];
92- return attributes[NSFileSize ];
93- }
94-
9589// /--------------------------------------
9690#pragma mark - Serialization
9791// /--------------------------------------
You can’t perform that action at this time.
0 commit comments