diff --git a/backend/pikpak/pikpak.go b/backend/pikpak/pikpak.go index c1376949ae0d8..befcf2580fb19 100644 --- a/backend/pikpak/pikpak.go +++ b/backend/pikpak/pikpak.go @@ -213,6 +213,11 @@ Fill in for rclone to use a non root folder as its starting point. Default: false, Help: "Only show files that are in the trash.\n\nThis will show trashed files in their original directory structure.", Advanced: true, + }, { + Name: "no_media_link", + Default: false, + Help: "Use original file links instead of media links.\n\nThis avoids issues caused by invalid media links, but may reduce download speeds.", + Advanced: true, }, { Name: "hash_memory_limit", Help: "Files bigger than this will be cached on disk to calculate hash if required.", @@ -286,6 +291,7 @@ type Options struct { RootFolderID string `config:"root_folder_id"` UseTrash bool `config:"use_trash"` TrashedOnly bool `config:"trashed_only"` + NoMediaLink bool `config:"no_media_link"` HashMemoryThreshold fs.SizeSuffix `config:"hash_memory_limit"` ChunkSize fs.SizeSuffix `config:"chunk_size"` UploadConcurrency int `config:"upload_concurrency"` @@ -1575,15 +1581,14 @@ func (o *Object) setMetaData(info *api.File) (err error) { o.md5sum = info.Md5Checksum if info.Links.ApplicationOctetStream != nil { o.link = info.Links.ApplicationOctetStream - if fid := parseFileID(o.link.URL); fid != "" { - for mid, media := range info.Medias { - if media.Link == nil { - continue - } - if mfid := parseFileID(media.Link.URL); fid == mfid { - fs.Debugf(o, "Using a media link from Medias[%d]", mid) - o.link = media.Link - break + if !o.fs.opt.NoMediaLink { + if fid := parseFileID(o.link.URL); fid != "" { + for _, media := range info.Medias { + if media.Link != nil && parseFileID(media.Link.URL) == fid { + fs.Debugf(o, "Using a media link") + o.link = media.Link + break + } } } }