mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
feat: support prefix path for storage files (#1258)
This commit is contained in:
@ -60,6 +60,7 @@ type Provider struct {
|
||||
IntranetEndpoint string `xorm:"varchar(100)" json:"intranetEndpoint"`
|
||||
Domain string `xorm:"varchar(100)" json:"domain"`
|
||||
Bucket string `xorm:"varchar(100)" json:"bucket"`
|
||||
PathPrefix string `xorm:"varchar(100)" json:"pathPrefix"`
|
||||
|
||||
Metadata string `xorm:"mediumtext" json:"metadata"`
|
||||
IdP string `xorm:"mediumtext" json:"idP"`
|
||||
|
@ -55,7 +55,7 @@ func escapePath(path string) string {
|
||||
}
|
||||
|
||||
func getUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool) (string, string) {
|
||||
escapedPath := escapePath(fullFilePath)
|
||||
escapedPath := util.UrlJoin(provider.PathPrefix, escapePath(fullFilePath))
|
||||
objectKey := util.UrlJoin(util.GetUrlPath(provider.Domain), escapedPath)
|
||||
|
||||
host := ""
|
||||
@ -70,7 +70,7 @@ func getUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool
|
||||
host = util.UrlJoin(provider.Domain, "/files")
|
||||
}
|
||||
if provider.Type == "Azure Blob" {
|
||||
host = fmt.Sprintf("%s/%s", host, provider.Bucket)
|
||||
host = util.UrlJoin(host, provider.Bucket)
|
||||
}
|
||||
|
||||
fileUrl := util.UrlJoin(host, escapePath(objectKey))
|
||||
|
Reference in New Issue
Block a user