瀏覽代碼

Fixed #1553 Cached file name with path extension UIWebView issue - for iOS 7 and above, remove the query from the url (prior to iOS 7 the behavior remains the same).

Bogdan Poplauschi 9 年之前
父節點
當前提交
fb0cdb6d
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      SDWebImage/SDWebImageManager.m

+ 7 - 1
SDWebImage/SDWebImageManager.m

@@ -56,7 +56,13 @@
         return self.cacheKeyFilter(url);
     }
     else {
-        return url.absoluteString;
+        if (NSClassFromString(@"NSURLComponents")) {
+            NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO];
+            urlComponents.query = nil; // Strip out query parameters.
+            return urlComponents.string;
+        } else {
+            return url.absoluteString;
+        }
     }
 }