diff --git a/README.md b/README.md index 12afeb6..90c3c38 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ ZNSTextAttachment enables NSTextAttachment to download images from remote URLs, ``` File > Swift Packages > Add Package Dependency Add https://github.com/ZhgChgLi/ZNSTextAttachment.git -Select "Up to Next Major" with "1.1.8" +Select "Up to Next Major" with "1.1.9" ``` or ```swift ... dependencies: [ - .package(url: "https://github.com/ZhgChgLi/ZNSTextAttachment.git", from: "1.1.8"), + .package(url: "https://github.com/ZhgChgLi/ZNSTextAttachment.git", from: "1.1.9"), ] ... .target( @@ -35,7 +35,7 @@ platform :ios, '12.0' use_frameworks! target 'MyApp' do - pod 'ZNSTextAttachment', '~> 1.1.8' + pod 'ZNSTextAttachment', '~> 1.1.9' end ``` diff --git a/Sources/ZNSTextAttachment/ZNSTextAttachment.swift b/Sources/ZNSTextAttachment/ZNSTextAttachment.swift index 706f9df..91f3ac6 100644 --- a/Sources/ZNSTextAttachment/ZNSTextAttachment.swift +++ b/Sources/ZNSTextAttachment/ZNSTextAttachment.swift @@ -84,12 +84,12 @@ public class ZNSTextAttachment: NSTextAttachment { let firstMatch = regex.firstMatch(in: imageURL.absoluteString, options: [], range: NSRange(location: 0, length: imageURL.absoluteString.count)), firstMatch.range(at: 1).location != NSNotFound, firstMatch.range(at: 2).location != NSNotFound, - let mimeTypeRange = Range(firstMatch.range(at: 1), in: imageURL.absoluteString), + let typeRange = Range(firstMatch.range(at: 1), in: imageURL.absoluteString), let base64StringRange = Range(firstMatch.range(at: 2), in: imageURL.absoluteString), let base64Data = Data(base64Encoded: String(imageURL.absoluteString[base64StringRange]), options: .ignoreUnknownCharacters) { - let mimeType = String(imageURL.absoluteString[mimeTypeRange]) - self.dataDownloaded(base64Data, mimeType: mimeType) + let type = String(imageURL.absoluteString[typeRange]) + self.dataDownloaded(base64Data, mimeType: "image/"+type) } else { let urlSessionDataTask = URLSession.shared.dataTask(with: imageURL) { (data, response, error) in diff --git a/scripts/ZNSTextAttachment.podspec b/scripts/ZNSTextAttachment.podspec index 257857a..5fa0efe 100644 --- a/scripts/ZNSTextAttachment.podspec +++ b/scripts/ZNSTextAttachment.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ZNSTextAttachment" - s.version = "1.1.8" + s.version = "1.1.9" s.summary = "ZNSTextAttachment enables NSTextAttachment to download images from remote URLs." s.homepage = "https://github.com/ZhgChgLi/ZNSTextAttachment" s.license = { :type => "MIT", :file => "LICENSE" }