Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

UIImageView+AFNetworking: Prevent stuck state for malformed urlRequest #4131

Merged
merged 4 commits into from Feb 26, 2018

Conversation

aduflo
Copy link
Contributor

@aduflo aduflo commented Jan 10, 2018

Addresses issue within setImageWithURLRequest:placeholderImage:success:failure:.

Issue:
If a NSURLRequest object is initialized with a malformed url (eg. passing an uninitialized string into URLWithString:), and is passed into setImageWithUrlRequest:, neither blocks (success or failure) get fired. When the method encounters a nil URL property of the NSURLRequest argument, cancelImageDownloadTask is called, but it's functionality depends on the existence of af_activeImageDownloadReceipt. In this case af_activeImageDownloadReceipt is nil, as the early return prevents a download task from starting, thus leaving the method caller waiting.

Proposal:
Replace cancelImageDownloadTask with the firing of the failure block.

@codecov-io
Copy link

codecov-io commented Jan 12, 2018

Codecov Report

Merging #4131 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4131      +/-   ##
==========================================
+ Coverage   87.69%   87.74%   +0.05%     
==========================================
  Files          46       46              
  Lines        5706     5730      +24     
  Branches      295      295              
==========================================
+ Hits         5004     5028      +24     
  Misses        702      702
Impacted Files Coverage Δ
Tests/Tests/AFUIImageViewTests.m 97.29% <100%> (+0.66%) ⬆️
UIKit+AFNetworking/UIImageView+AFNetworking.m 97.01% <100%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29e0573...6184295. Read the comment docs.

@aduflo aduflo changed the title UIImageView+AFNetworking: Prevent stuck state for bad urlRequest UIImageView+AFNetworking: Prevent stuck state for malformed urlRequest Jan 12, 2018
Copy link
Contributor

@SlaunchaMan SlaunchaMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me; once this is building cleanly with no CI failures we’re good to go!

@aduflo
Copy link
Contributor Author

aduflo commented Feb 15, 2018

@SlaunchaMan from what I can tell, build job #5 failed due to a fastlane error: https://travis-ci.org/AFNetworking/AFNetworking/jobs/328142514

I'd restart the build job but do not have the proper permissions to do so; would you be able to restart the build job?

@SlaunchaMan
Copy link
Contributor

Restarted!

@aduflo
Copy link
Contributor Author

aduflo commented Feb 15, 2018

@SlaunchaMan got my fork UTD w/ master, and pushed a merge into the PR and saw all build jobs failing

it seems master has a handful of failing tests:
screen shot 2018-02-15 at 10 20 17 am

@SlaunchaMan
Copy link
Contributor

Looks like some certificates expired that we use for tests. I'll update those shortly!

@SlaunchaMan
Copy link
Contributor

Tests have been updated. Once you merge in master and the tests pass this is good to go!

@aduflo
Copy link
Contributor Author

aduflo commented Feb 25, 2018

master merged and seein' ✅s. 👍

@SlaunchaMan SlaunchaMan merged commit 1a5b481 into AFNetworking:master Feb 26, 2018
@SlaunchaMan SlaunchaMan added this to the 3.2.1 milestone May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants