Rewind mode list directory bug fix (#1297)
* rewind bug fix * adding constant
This commit is contained in:
@@ -389,7 +389,7 @@ func computeObjectURLWithoutEncode(bucketName, prefix string) (string, error) {
|
||||
objectURL = path.Join(objectURL, bucketName)
|
||||
}
|
||||
if strings.TrimSpace(prefix) != "" {
|
||||
objectURL = path.Join(objectURL, prefix)
|
||||
objectURL = pathJoinFinalSlash(objectURL, prefix)
|
||||
}
|
||||
|
||||
objectURL = fmt.Sprintf("%s://%s", u.Scheme, objectURL)
|
||||
@@ -418,6 +418,16 @@ func newS3BucketClient(claims *models.Principal, bucketName string, prefix strin
|
||||
return s3Client, nil
|
||||
}
|
||||
|
||||
// pathJoinFinalSlash - like path.Join() but retains trailing slashSeparator of the last element
|
||||
func pathJoinFinalSlash(elem ...string) string {
|
||||
if len(elem) > 0 {
|
||||
if strings.HasSuffix(elem[len(elem)-1], SlashSeparator) {
|
||||
return path.Join(elem...) + SlashSeparator
|
||||
}
|
||||
}
|
||||
return path.Join(elem...)
|
||||
}
|
||||
|
||||
// newS3Config simply creates a new Config struct using the passed
|
||||
// parameters.
|
||||
func newS3Config(endpoint, accessKey, secretKey, sessionToken string, insecure bool) *mc.Config {
|
||||
|
||||
@@ -54,4 +54,5 @@ const (
|
||||
ConsoleLogQueryURL = "CONSOLE_LOG_QUERY_URL"
|
||||
ConsoleLogQueryAuthToken = "CONSOLE_LOG_QUERY_AUTH_TOKEN"
|
||||
LogSearchQueryAuthToken = "LOGSEARCH_QUERY_AUTH_TOKEN"
|
||||
SlashSeparator = "/"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user