mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Fix: missing x-oss-process params in thumb url in public oss bucket
This commit is contained in:
@@ -179,6 +179,7 @@ func (handler Driver) Thumb(ctx context.Context, path string) (*response.Content
|
||||
}
|
||||
|
||||
thumbParam := fmt.Sprintf("image/resize,m_lfit,h_%d,w_%d", thumbSize[1], thumbSize[0])
|
||||
ctx = context.WithValue(ctx, fsctx.ThumbSizeCtx, thumbParam)
|
||||
thumbOption := []oss.Option{oss.Process(thumbParam)}
|
||||
thumbURL, err := handler.signSourceURL(
|
||||
ctx,
|
||||
@@ -248,6 +249,12 @@ func (handler Driver) signSourceURL(ctx context.Context, path string, ttl int64,
|
||||
return "", err
|
||||
}
|
||||
sourceURL := cdnURL.ResolveReference(file)
|
||||
|
||||
// 如果有缩略图设置
|
||||
if thumbSize, ok := ctx.Value(fsctx.ThumbSizeCtx).(string); ok {
|
||||
sourceURL.RawQuery = "x-oss-process=" + thumbSize
|
||||
}
|
||||
|
||||
return sourceURL.String(), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user