Skip to content

Commit a7c11f6

Browse files
authored
fix: ios - untracable crashes when URL is not parsable (#183)
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
1 parent b190f41 commit a7c11f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ios/VydiaRNFileUploader.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ - (void)copyAssetToFile: (NSString *)assetUrl completionHandler: (void(^)(NSStri
156156
@try {
157157
NSURL *requestUrl = [NSURL URLWithString: uploadUrl];
158158
if (requestUrl == nil) {
159-
@throw @"Request cannot be nil";
159+
return reject(@"RN Uploader", @"URL not compliant with RFC 2396", nil);
160160
}
161-
161+
162162
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestUrl];
163163
[request setHTTPMethod: method];
164164

0 commit comments

Comments
 (0)