-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add Kingsoft Cloud object storage policy to solve the cross-domain and friendly file name incompatibility problem of s3 compatible storage policy. #2665
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
Conversation
Thanks a lot! Will take a look in a few days. |
association frontend Pr: cloudreve/frontend#285 |
pkg/filemanager/driver/ks3/ks3.go
Outdated
var contentDescription *string | ||
if args.IsDownload { | ||
encodedFilename := url.PathEscape(args.DisplayName) | ||
contentDescription = aws.String(fmt.Sprintf(`attachment; filename="%s"`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to remove the punctuation mark:
contentDescription = aws.String(fmt.Sprintf(`attachment; filename=%s`, encodedFilename))
pkg/filemanager/driver/ks3/ks3.go
Outdated
HTTPMethod: s3.GET, // 请求方法 | ||
Bucket: &handler.policy.BucketName, // 存储空间名称 | ||
Key: aws.String(e.Source()), // 对象的key | ||
Expires: 604800, // 过期时间,7 days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not follow args.Expire
?
pkg/filemanager/driver/ks3/ks3.go
Outdated
ContentType: aws.String("application/octet-stream"), | ||
}) | ||
if err != nil { | ||
return fmt.Errorf("生成分片%d预签名URL失败: %w", partNumber, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("failed to generate presigned upload url for chunk %d: %w", partNumber, err)
Codes have been corrected as required |
pkg/filemanager/driver/ks3/ks3.go
Outdated
HTTPMethod: s3.GET, // 请求方法 | ||
Bucket: &handler.policy.BucketName, // 存储空间名称 | ||
Key: aws.String(e.Source()), // 对象的key | ||
Expires: int64(time.Until(*args.Expire).Seconds()), // 过期时间,转换为秒数 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to https://github.com/cloudreve/cloudreve/blob/1cdccf5fc95aa7be432666e7f93ae95e02b61297/pkg/filemanager/driver/s3/s3.go#L309C2-L312C3
args.Expire
might be nil
, in which case default max TTL wil be used (7 days)
Thanks! |
Closes #2642