Skip to content

Commit 9c76911

Browse files
author
Guy Blank
committed
upload task - check if upload file exists
1 parent 3aec419 commit 9c76911

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ios/RNFetchBlobRequest.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
100100
uploadTask = [options valueForKey:@"IOSUploadTask"] == nil ? NO : [[options valueForKey:@"IOSUploadTask"] boolValue];
101101

102102
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+
}
103109

104110
// when followRedirect not set in options, defaults to TRUE
105111
followRedirect = [options valueForKey:@"followRedirect"] == nil ? YES : [[options valueForKey:@"followRedirect"] boolValue];

0 commit comments

Comments
 (0)