@@ -113,7 +113,7 @@ - (NSMutableDictionary *)getMetadataForUrl:(NSURL *)url error:(NSError **)error
113113 if (mode == UIDocumentPickerModeOpen) {
114114 [urlsInOpenMode addObject: url];
115115 }
116-
116+
117117 // TODO handle error
118118 [url startAccessingSecurityScopedResource ];
119119
@@ -124,12 +124,12 @@ - (NSMutableDictionary *)getMetadataForUrl:(NSURL *)url error:(NSError **)error
124124 [coordinator coordinateReadingItemAtURL: url options: NSFileCoordinatorReadingResolvesSymbolicLink error: &fileError byAccessor: ^(NSURL *newURL) {
125125 // If the coordinated operation fails, then the accessor block never runs
126126 result[FIELD_URI] = ((mode == UIDocumentPickerModeOpen) ? url : newURL).absoluteString ;
127-
127+
128128 NSError *copyError;
129- NSString *maybeFileCopyPath = copyDestination ? [RNDocumentPicker copyToUniqueDestinationFrom: newURL usingDestinationPreset: copyDestination error: copyError]. absoluteString : nil ;
130-
129+ NSURL *maybeFileCopyPath = copyDestination ? [RNDocumentPicker copyToUniqueDestinationFrom: newURL usingDestinationPreset: copyDestination error: & copyError] : nil ;
130+
131131 if (!copyError) {
132- result[FIELD_FILE_COPY_URI] = RCTNullIfNil (maybeFileCopyPath);
132+ result[FIELD_FILE_COPY_URI] = RCTNullIfNil (maybeFileCopyPath. absoluteString );
133133 } else {
134134 result[FIELD_COPY_ERR] = copyError.localizedDescription ;
135135 result[FIELD_FILE_COPY_URI] = [NSNull null ];
@@ -191,21 +191,21 @@ - (NSMutableDictionary *)getMetadataForUrl:(NSURL *)url error:(NSError **)error
191191 resolve (nil );
192192}
193193
194- + (NSURL *)copyToUniqueDestinationFrom : (NSURL *)url usingDestinationPreset : (NSString *)copyToDirectory error : (NSError *)error
194+ + (NSURL *)copyToUniqueDestinationFrom : (NSURL *)url usingDestinationPreset : (NSString *)copyToDirectory error : (NSError ** )error
195195{
196196 NSURL *destinationRootDir = [self getDirectoryForFileCopy: copyToDirectory];
197197 // we don't want to rename the file so we put it into a unique location
198198 NSString *uniqueSubDirName = [[NSUUID UUID ] UUIDString ];
199199 NSURL *destinationDir = [destinationRootDir URLByAppendingPathComponent: [NSString stringWithFormat: @" %@ /" , uniqueSubDirName]];
200200 NSURL *destinationUrl = [destinationDir URLByAppendingPathComponent: [NSString stringWithFormat: @" %@ " , url.lastPathComponent]];
201201
202- [NSFileManager .defaultManager createDirectoryAtURL: destinationDir withIntermediateDirectories: YES attributes: nil error: & error];
203- if (error) {
204- return url ;
202+ [NSFileManager .defaultManager createDirectoryAtURL: destinationDir withIntermediateDirectories: YES attributes: nil error: error];
203+ if (* error) {
204+ return nil ;
205205 }
206- [NSFileManager .defaultManager copyItemAtURL: url toURL: destinationUrl error: & error];
207- if (error) {
208- return url ;
206+ [NSFileManager .defaultManager copyItemAtURL: url toURL: destinationUrl error: error];
207+ if (* error) {
208+ return nil ;
209209 } else {
210210 return destinationUrl;
211211 }
0 commit comments