Commit 25163a26 authored by pete谢兆麟's avatar pete谢兆麟

bucketPath处理

parent f3c5ebb9
......@@ -141,12 +141,17 @@ class YHOSSManager: NSObject, URLSessionDelegate {
func getPublic(url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let bucketName = self.model.bucket
let pathComponents = url.pathComponents
var bucketPath = ""
if pathComponents.count >= 4 {
bucketPath = pathComponents[2] + "/" + pathComponents[3]
var pathComponents = url.pathComponents
var objectKey = ""
for i in 0..<pathComponents.count {
if i == 0 || i == 1 {
} else if i == pathComponents.count - 1 {
objectKey = objectKey + pathComponents[i]
} else {
objectKey = objectKey + pathComponents[i] + "/"
}
}
let objectKey = bucketPath + "/" + url.lastPathComponent
let task = mClient.presignConstrainURL(withBucketName: bucketName, withObjectKey: objectKey, withExpirationInterval: 60 * 5)
task.continue({ (t) -> Any? in
let result = t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment