Skip to content

Commit

Permalink
check empty url
Browse files Browse the repository at this point in the history
  • Loading branch information
evermeer committed Dec 22, 2015
1 parent 3d9b97a commit 3f5ec8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EVURLCache.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
#

s.name = "EVURLCache"
s.version = "2.1.4"
s.version = "2.1.5"
s.summary = "NSURLCache subclass for handeling all web requests that use NSURLRequest"
s.description = "This is a NSURLCache subclass for handeling all web requests that use NSURLRequest. (This includes UIWebView)"
s.homepage = "https://github.com/evermeer/EVURLCache"
Expand Down
8 changes: 4 additions & 4 deletions EVURLCache/Pod/EVURLCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ public class EVURLCache : NSURLCache {

// Will be called by a NSURLConnection when it's wants to know if there is something in the cache.
public override func cachedResponseForRequest(request: NSURLRequest) -> NSCachedURLResponse? {
guard let _ = request.URL else {
guard let url = request.URL else {
EVURLCache.debugLog("CACHE not allowed for nil URLs");
return nil
}

if request.URL!.absoluteString.isEmpty {
if url.absoluteString.isEmpty {
EVURLCache.debugLog("CACHE not allowed for empty URLs");
return nil;
}

// is caching allowed
if ((request.cachePolicy == NSURLRequestCachePolicy.ReloadIgnoringCacheData || request.URL!.absoluteString.hasPrefix("file:/") || request.URL!.absoluteString.hasPrefix("data:")) && EVURLCache.networkAvailable()) {
EVURLCache.debugLog("CACHE not allowed for \(request.URL)");
if ((request.cachePolicy == NSURLRequestCachePolicy.ReloadIgnoringCacheData || url.absoluteString.hasPrefix("file:/") || url.absoluteString.hasPrefix("data:")) && EVURLCache.networkAvailable()) {
EVURLCache.debugLog("CACHE not allowed for \(url)");
return nil;
}

Expand Down

0 comments on commit 3f5ec8e

Please sign in to comment.