|
|
@ -3,6 +3,7 @@ package model
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"encoding/gob"
|
|
|
|
"encoding/gob"
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
@ -239,7 +240,7 @@ func (policy *Policy) GetUploadURL() string {
|
|
|
|
return policy.Server
|
|
|
|
return policy.Server
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var controller *url.URL
|
|
|
|
controller, _ := url.Parse("")
|
|
|
|
switch policy.Type {
|
|
|
|
switch policy.Type {
|
|
|
|
case "local", "onedrive":
|
|
|
|
case "local", "onedrive":
|
|
|
|
return "/api/v3/file/upload"
|
|
|
|
return "/api/v3/file/upload"
|
|
|
@ -251,9 +252,17 @@ func (policy *Policy) GetUploadURL() string {
|
|
|
|
return policy.Server
|
|
|
|
return policy.Server
|
|
|
|
case "upyun":
|
|
|
|
case "upyun":
|
|
|
|
return "https://v0.api.upyun.com/" + policy.BucketName
|
|
|
|
return "https://v0.api.upyun.com/" + policy.BucketName
|
|
|
|
default:
|
|
|
|
case "s3":
|
|
|
|
controller, _ = url.Parse("")
|
|
|
|
if policy.Server == "" {
|
|
|
|
|
|
|
|
return fmt.Sprintf("https://%s.s3.%s.amazonaws.com/", policy.BucketName,
|
|
|
|
|
|
|
|
policy.OptionsSerialized.Region)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !strings.Contains(policy.Server, policy.BucketName) {
|
|
|
|
|
|
|
|
controller, _ = url.Parse("/" + policy.BucketName)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return server.ResolveReference(controller).String()
|
|
|
|
return server.ResolveReference(controller).String()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|