Skip to content

Commit

Permalink
fix: ios - untracable crashes when URL is not parsable (#183)
Browse files Browse the repository at this point in the history
Due to NSURL checking compliance with RFC 2396 while parsing the url, sometimes when the URL is not compilant with the RFC it is considered `nil` and code throws this error. The problem is that this error is not caught anywhere, therefore crashing with a very unhelpful stack trace, as seen here: #121
  • Loading branch information
Palid committed Mar 22, 2020
1 parent b190f41 commit a7c11f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ios/VydiaRNFileUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ - (void)copyAssetToFile: (NSString *)assetUrl completionHandler: (void(^)(NSStri
@try {
NSURL *requestUrl = [NSURL URLWithString: uploadUrl];
if (requestUrl == nil) {
@throw @"Request cannot be nil";
return reject(@"RN Uploader", @"URL not compliant with RFC 2396", nil);
}

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestUrl];
[request setHTTPMethod: method];

Expand Down

0 comments on commit a7c11f6

Please sign in to comment.