mirror of
https://github.com/cloudreve/cloudreve.git
synced 2025-10-28 11:04:47 +08:00
fix(thumb blob path): remove extra randomkey in thumb blob path (#2893)
* fix(thumb blob path): remove extra randomkey in thumb blob path * Update upload.go Refactor SavePath assignment for clarity. * Update thumbnail.go
This commit is contained in:
@ -146,11 +146,7 @@ func (f *DBFS) PrepareUpload(ctx context.Context, req *fs.UploadRequest, opts ..
|
|||||||
if req.Props.SavePath == "" || isThumbnailAndPolicyNotAvailable {
|
if req.Props.SavePath == "" || isThumbnailAndPolicyNotAvailable {
|
||||||
req.Props.SavePath = generateSavePath(policy, req, f.user)
|
req.Props.SavePath = generateSavePath(policy, req, f.user)
|
||||||
if isThumbnailAndPolicyNotAvailable {
|
if isThumbnailAndPolicyNotAvailable {
|
||||||
req.Props.SavePath = fmt.Sprintf(
|
req.Props.SavePath = req.Props.SavePath + f.settingClient.ThumbEntitySuffix(ctx)
|
||||||
"%s.%s%s",
|
|
||||||
req.Props.SavePath,
|
|
||||||
util.RandStringRunes(16),
|
|
||||||
f.settingClient.ThumbEntitySuffix(ctx))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -182,13 +182,9 @@ func (m *manager) generateThumb(ctx context.Context, uri *fs.URI, ext string, es
|
|||||||
entityType := types.EntityTypeThumbnail
|
entityType := types.EntityTypeThumbnail
|
||||||
req := &fs.UploadRequest{
|
req := &fs.UploadRequest{
|
||||||
Props: &fs.UploadProps{
|
Props: &fs.UploadProps{
|
||||||
Uri: uri,
|
Uri: uri,
|
||||||
Size: fileInfo.Size(),
|
Size: fileInfo.Size(),
|
||||||
SavePath: fmt.Sprintf(
|
SavePath: es.Entity().Source() + m.settings.ThumbEntitySuffix(ctx),
|
||||||
"%s%s",
|
|
||||||
es.Entity().Source(),
|
|
||||||
m.settings.ThumbEntitySuffix(ctx),
|
|
||||||
),
|
|
||||||
MimeType: m.dep.MimeDetector(ctx).TypeByName("thumb.jpg"),
|
MimeType: m.dep.MimeDetector(ctx).TypeByName("thumb.jpg"),
|
||||||
EntityType: &entityType,
|
EntityType: &entityType,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user