Skip to content

Commit

Permalink
Some servers apparently don't return content length headers. (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmoon authored May 24, 2017
1 parent 3781e4b commit 5ea785e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [fixed] Fixes an issue where PINResume would assert because the server didn't return an expected content length.
- [fixed] Fixed bytes per second on download tasks (which could affect if an image is progressively rendered) [#360](https://github.com/pinterest/PINRemoteImage/pull/360) [garrettmoon](https://github.com/garrettmoon)
- [new] Added request configuration handler to allow customizing HTTP headers per request [#355](https://github.com/pinterest/PINRemoteImage/pull/355) [zachwaugh](https://github.com/zachwaugh)
- [fixed] Moved storage of resume data to disk from memory. [garrettmoon](https://github.com/garrettmoon)
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/PINRemoteImageDownloadTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ - (BOOL)cancelWithUUID:(NSUUID *)UUID resume:(PINResume * _Nullable * _Nullable)
[self.manager.urlSessionTaskQueue removeDownloadTaskFromQueue:_progressImage.dataTask];
[_progressImage.dataTask cancel];

if (resume && _ifRange && _progressImage.dataTask.countOfBytesExpectedToReceive > 0) {
if (resume && _ifRange && _progressImage.dataTask.countOfBytesExpectedToReceive > 0 && _progressImage.dataTask.countOfBytesExpectedToReceive != NSURLSessionTransferSizeUnknown) {
NSData *progressData = _progressImage.data;
if (progressData.length > 0) {
*resume = [PINResume resumeData:progressData ifRange:_ifRange totalBytes:_progressImage.dataTask.countOfBytesExpectedToReceive];
Expand Down

0 comments on commit 5ea785e

Please sign in to comment.