Skip to content

Commit

Permalink
Merge branch 'release/v0.18.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gee1k committed Apr 2, 2020
2 parents e45e925 + 08737b3 commit ead3999
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 4 additions & 4 deletions uPic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200328;
CURRENT_PROJECT_VERSION = 20200402;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist";
Expand All @@ -1236,7 +1236,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.18.1;
MARKETING_VERSION = 0.18.2;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1257,7 +1257,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200328;
CURRENT_PROJECT_VERSION = 20200402;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist";
Expand All @@ -1266,7 +1266,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.18.1;
MARKETING_VERSION = 0.18.2;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 2 additions & 0 deletions uPic/Models/Custom/CustomHostUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class CustomHostUtil {
获取json结果中的url
*/
public static func parseResultUrl(_ json: JSON, _ resultPath: String) -> String {
let resultPath = resultPath.replacingOccurrences(of: "'", with: "\"").replacingOccurrences(of: "", with: ",")

var retUrl = ""
let retJson = json

Expand Down
14 changes: 12 additions & 2 deletions uPic/Models/Custom/CustomUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class CustomUploader: BaseUploader {
}
}
}
multipartFormData.append(saveKey.data(using: .utf8)!, withName: "key")
if retData != nil {
multipartFormData.append(retData!, withName: field, fileName: fileName, mimeType: mimeType)
} else if fileUrl != nil {
Expand All @@ -141,6 +140,7 @@ class CustomUploader: BaseUploader {
}.responseJSON(completionHandler: { response -> Void in
switch response.result {
case .success(let value):
debugPrint(value)
let json = JSON(value)
var retUrl = CustomHostUtil.parseResultUrl(json, config.resultPath ?? "")
if retUrl.isEmpty {
Expand All @@ -157,8 +157,18 @@ class CustomUploader: BaseUploader {
})
}

var isApplicationJson = false
for (_, header) in headers.enumerated() {
if header.name.lowercased() != "content-type" {
continue
}
if header.value.lowercased().contains("application/json") {
isApplicationJson = true
break
}
}

if config.useBase64 {
if isApplicationJson {
_byRequest()
} else {
_byUpload()
Expand Down

0 comments on commit ead3999

Please sign in to comment.