소스 검색

upload task - check if upload file exists

Guy Blank 5 년 전
부모
커밋
9c76911e98
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6
    0
      ios/RNFetchBlobRequest.m

+ 6
- 0
ios/RNFetchBlobRequest.m 파일 보기

100
     uploadTask = [options valueForKey:@"IOSUploadTask"] == nil ? NO : [[options valueForKey:@"IOSUploadTask"] boolValue];
100
     uploadTask = [options valueForKey:@"IOSUploadTask"] == nil ? NO : [[options valueForKey:@"IOSUploadTask"] boolValue];
101
     
101
     
102
     NSString * filepath = [options valueForKey:@"uploadFilePath"];
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
     // when followRedirect not set in options, defaults to TRUE
110
     // when followRedirect not set in options, defaults to TRUE
105
     followRedirect = [options valueForKey:@"followRedirect"] == nil ? YES : [[options valueForKey:@"followRedirect"] boolValue];
111
     followRedirect = [options valueForKey:@"followRedirect"] == nil ? YES : [[options valueForKey:@"followRedirect"] boolValue];