From ded8b680981388df9eb8c2c3b6d92956f448dafd Mon Sep 17 00:00:00 2001 From: zarzet Date: Sun, 14 Jun 2026 14:12:37 +0700 Subject: [PATCH] fix(download): honor requested quality when fallback provider recognizes it --- go_backend/extension_providers.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/go_backend/extension_providers.go b/go_backend/extension_providers.go index 38326e7b..81d53af8 100644 --- a/go_backend/extension_providers.go +++ b/go_backend/extension_providers.go @@ -2532,12 +2532,26 @@ func DownloadWithExtensionFallback(req DownloadRequest) (*DownloadResponse, erro StartItemProgress(req.ItemID) } - // Fallback provider: request its own highest quality, not the - // source provider's quality token. + // Honor the requested quality when this provider recognizes it + // (e.g. an explicit user selection). Only when the token is not + // one of this provider's own options do we fall back to its + // highest quality, since a source provider's token may not map. fallbackQuality := req.Quality if len(ext.Manifest.QualityOptions) > 0 { - if best := strings.TrimSpace(ext.Manifest.QualityOptions[0].ID); best != "" { - fallbackQuality = best + requested := strings.TrimSpace(req.Quality) + recognized := false + if requested != "" { + for _, opt := range ext.Manifest.QualityOptions { + if strings.EqualFold(strings.TrimSpace(opt.ID), requested) { + recognized = true + break + } + } + } + if !recognized { + if best := strings.TrimSpace(ext.Manifest.QualityOptions[0].ID); best != "" { + fallbackQuality = best + } } }