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
99
99
[request setValue: contentType forHTTPHeaderField: PFHTTPRequestHeaderNameContentType];
100
100
}
101
101
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
+ }
105
112
106
113
return request;
107
114
}];
Original file line number Diff line number Diff line change 22
22
+ (NSString *)parseServerURLString ;
23
23
+ (void )setParseServer : (NSString *)server ;
24
24
25
- + (NSNumber *)fileSizeOfFileAtPath : (NSString *)filePath error : (NSError **)error ;
26
-
27
25
/* *
28
26
Clears system time zone cache, gets the name of the time zone
29
27
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
86
86
#pragma clang diagnostic pop
87
87
}
88
88
89
- + (NSNumber *)fileSizeOfFileAtPath : (NSString *)filePath error : (NSError **)error {
90
- NSDictionary *attributes = [[NSFileManager defaultManager ] attributesOfItemAtPath: filePath
91
- error: error];
92
- return attributes[NSFileSize ];
93
- }
94
-
95
89
// /--------------------------------------
96
90
#pragma mark - Serialization
97
91
// /--------------------------------------
You can’t perform that action at this time.
0 commit comments