mirror of
https://github.com/status-im/react-native-fs.git
synced 2025-03-01 07:20:33 +00:00
Merge branch 'master' of github.com:itinance/react-native-fs
* 'master' of github.com:itinance/react-native-fs: Handle 307/308 redirect set response statuscode even if content length is zero Update Downloader.m Update Downloader.m
This commit is contained in:
commit
6539499c84
@ -88,6 +88,10 @@
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
|
||||
{
|
||||
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)downloadTask.response;
|
||||
if (!_statusCode) {
|
||||
_statusCode = [NSNumber numberWithLong:httpResponse.statusCode];
|
||||
}
|
||||
NSURL *destURL = [NSURL fileURLWithPath:_params.toFile];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSError *error = nil;
|
||||
@ -102,7 +106,9 @@
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
|
||||
{
|
||||
return error ? _params.errorCallback(error) : nil;
|
||||
if (error && error.code != -999) {
|
||||
_params.errorCallback(error);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopDownload
|
||||
|
@ -67,7 +67,9 @@ public class Downloader extends AsyncTask<DownloadParams, int[], DownloadResult>
|
||||
statusCode != HttpURLConnection.HTTP_OK &&
|
||||
(
|
||||
statusCode == HttpURLConnection.HTTP_MOVED_PERM ||
|
||||
statusCode == HttpURLConnection.HTTP_MOVED_TEMP
|
||||
statusCode == HttpURLConnection.HTTP_MOVED_TEMP ||
|
||||
statusCode == 307 ||
|
||||
statusCode == 308
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user