Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生成文件下载地址时,object如果是在目录中的,会导致找不到文件 #359

Open
xiaofeige opened this issue Nov 24, 2022 · 0 comments

Comments

@xiaofeige
Copy link

`
// buildURL builds URL
func (um urlMaker) buildURL(bucket, object string) (string, string) {
var host = ""
var path = ""

object = url.QueryEscape(object)
object = strings.Replace(object, "+", "%20", -1)

if um.Type == urlTypeCname {
	host = um.NetLoc
	path = "/" + object
} else if um.Type == urlTypeIP {
	if bucket == "" {
		host = um.NetLoc
		path = "/"
	} else {
		host = um.NetLoc
		path = fmt.Sprintf("/%s/%s", bucket, object)
	}
} else {
	if bucket == "" {
		host = um.NetLoc
		path = "/"
	} else {
		host = bucket + "." + um.NetLoc
		path = "/" + object
	}
}

return host, path

}
`

当传入的object 为 "/path/to/my-object" , 斜线都会被encode,那么就是说生成下载连接只要是这种多层目录的,都有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant