Skip to content

Commit 488426d

Browse files
authored
fix(139): honor use_large_thumbnail for family/personal/group clouds (#9562)
The use_large_thumbnail toggle was only wired into the personal_new listing path; the family (家庭云), personal and group listings always used the small thumbnailURL and ignored the option. The 139 queryContentList APIs already return a bigthumbnailURL field alongside thumbnailURL, so parse it and select the large variant via a shared pickThumbnail helper when use_large_thumbnail is enabled, falling back to the regular thumbnail when no large URL is provided. Fixes #9391
1 parent 9a36bd1 commit 488426d

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

drivers/139/types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ type Content struct {
5858
CreateTime string `json:"createTime"`
5959
UpdateTime string `json:"updateTime"`
6060
//CommentCount int `json:"commentCount"`
61-
ThumbnailURL string `json:"thumbnailURL"`
62-
//BigthumbnailURL string `json:"bigthumbnailURL"`
61+
ThumbnailURL string `json:"thumbnailURL"`
62+
BigthumbnailURL string `json:"bigthumbnailURL"`
6363
//PresentURL string `json:"presentURL"`
6464
//PresentLURL string `json:"presentLURL"`
6565
//PresentHURL string `json:"presentHURL"`
@@ -162,10 +162,10 @@ type CloudContent struct {
162162
//ContentDesc string `json:"contentDesc"`
163163
CreateTime string `json:"createTime"`
164164
//Shottime interface{} `json:"shottime"`
165-
LastUpdateTime string `json:"lastUpdateTime"`
166-
ThumbnailURL string `json:"thumbnailURL"`
165+
LastUpdateTime string `json:"lastUpdateTime"`
166+
ThumbnailURL string `json:"thumbnailURL"`
167+
BigthumbnailURL string `json:"bigthumbnailURL"`
167168
//MidthumbnailURL string `json:"midthumbnailURL"`
168-
//BigthumbnailURL string `json:"bigthumbnailURL"`
169169
//PresentURL string `json:"presentURL"`
170170
//PresentLURL string `json:"presentLURL"`
171171
//PresentHURL string `json:"presentHURL"`
@@ -349,4 +349,4 @@ type ShareContentInfoResp struct {
349349
Data struct {
350350
ContentInfo ShareContentInfo `json:"contentInfo"`
351351
} `json:"data"`
352-
}
352+
}

drivers/139/util.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,7 @@ func (d *Yun139) getFiles(catalogID string) ([]model.Obj, error) {
367367
Modified: getTime(content.UpdateTime),
368368
HashInfo: utils.NewHashInfo(utils.MD5, content.Digest),
369369
},
370-
Thumbnail: model.Thumbnail{Thumbnail: content.ThumbnailURL},
371-
//Thumbnail: content.BigthumbnailURL,
370+
Thumbnail: model.Thumbnail{Thumbnail: d.pickThumbnail(content.ThumbnailURL, content.BigthumbnailURL)},
372371
}
373372
files = append(files, &f)
374373
}
@@ -380,6 +379,16 @@ func (d *Yun139) getFiles(catalogID string) ([]model.Obj, error) {
380379
return files, nil
381380
}
382381

382+
// pickThumbnail returns the large thumbnail URL when UseLargeThumbnail is
383+
// enabled and the API provided one, otherwise it falls back to the regular
384+
// thumbnail URL.
385+
func (d *Yun139) pickThumbnail(thumbnailURL, bigThumbnailURL string) string {
386+
if d.UseLargeThumbnail && bigThumbnailURL != "" {
387+
return bigThumbnailURL
388+
}
389+
return thumbnailURL
390+
}
391+
383392
func (d *Yun139) newJson(data map[string]interface{}) base.Json {
384393
common := map[string]interface{}{
385394
"catalogType": 3,
@@ -434,8 +443,7 @@ func (d *Yun139) familyGetFiles(catalogID string) ([]model.Obj, error) {
434443
Ctime: getTime(content.CreateTime),
435444
Path: path, // 文件所在目录的Path
436445
},
437-
Thumbnail: model.Thumbnail{Thumbnail: content.ThumbnailURL},
438-
//Thumbnail: content.BigthumbnailURL,
446+
Thumbnail: model.Thumbnail{Thumbnail: d.pickThumbnail(content.ThumbnailURL, content.BigthumbnailURL)},
439447
}
440448
files = append(files, &f)
441449
}
@@ -489,8 +497,7 @@ func (d *Yun139) groupGetFiles(catalogID string) ([]model.Obj, error) {
489497
Ctime: getTime(content.CreateTime),
490498
Path: path, // 文件所在目录的Path
491499
},
492-
Thumbnail: model.Thumbnail{Thumbnail: content.ThumbnailURL},
493-
//Thumbnail: content.BigthumbnailURL,
500+
Thumbnail: model.Thumbnail{Thumbnail: d.pickThumbnail(content.ThumbnailURL, content.BigthumbnailURL)},
494501
}
495502
files = append(files, &f)
496503
}

0 commit comments

Comments
 (0)