It's using a double-pass string replacement to properly encode the URL, due to deficiencies in stringByAddingPercentEncodingWithAllowedCharacters when using the URLHostAllowedCharacterSet. Equal signs are not encoded into %3D correctly.
It will break if another web protocol should come along that is not prefixed with http.
Coverage remained the same at 100.0% when pulling 1ad6c843488febe1ee68dc92df231139955cfe78 on kellysutton:fully-qualified-urls-as-paths into 4bfee28b5b20cc0eca1198b1b700960c4cb1b651 on soffes:master.
It's a common imgix gotcha to not encode fully-qualified URLs when using a Web Proxy source. See the bottom section of http://www.imgix.com/docs/tutorials/creating-sources for more info on Web Proxy sources.
This code is little gross for a few reasons:
stringByAddingPercentEncodingWithAllowedCharacters
when using theURLHostAllowedCharacterSet
. Equal signs are not encoded into%3D
correctly.http
.What's a better way of accomplishing this?