Skip to content

Commit

Permalink
fix(ios): mitigate media memory usage (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Oct 30, 2019
1 parent 173a313 commit cbd526d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ios/IONAssetHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)ur
}
}
}

NSData * data = [[NSData alloc] initWithContentsOfFile:startPath];
NSError * fileError = nil;
NSData * data = nil;
if ([self isMediaExtension:url.pathExtension]) {
data = [NSData dataWithContentsOfFile:startPath options:NSDataReadingMappedIfSafe error:&fileError];
}
if (!data || fileError) {
data = [[NSData alloc] initWithContentsOfFile:startPath];
}
NSInteger statusCode = 200;
if (!data) {
statusCode = 404;
Expand Down

0 comments on commit cbd526d

Please sign in to comment.