Przeglądaj źródła

upload task - check if upload file exists

Guy Blank 5 lat temu
rodzic
commit
9c76911e98
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6
    0
      ios/RNFetchBlobRequest.m

+ 6
- 0
ios/RNFetchBlobRequest.m Wyświetl plik

@@ -100,6 +100,12 @@ typedef NS_ENUM(NSUInteger, ResponseFormat) {
100 100
     uploadTask = [options valueForKey:@"IOSUploadTask"] == nil ? NO : [[options valueForKey:@"IOSUploadTask"] boolValue];
101 101
     
102 102
     NSString * filepath = [options valueForKey:@"uploadFilePath"];
103
+
104
+    if (uploadTask && ![[NSFileManager defaultManager] fileExistsAtPath:filepath]) {
105
+        RCTLog(@"[RNFetchBlobRequest] sendRequest uploadTask file doesn't exist %@", filepath);
106
+        callback(@[@"uploadTask file doesn't exist", @"", [NSNull null]]);
107
+        return;
108
+    }
103 109
     
104 110
     // when followRedirect not set in options, defaults to TRUE
105 111
     followRedirect = [options valueForKey:@"followRedirect"] == nil ? YES : [[options valueForKey:@"followRedirect"] boolValue];