mirror of
https://github.com/spotiflacapp/SpotiFLAC-Mobile.git
synced 2026-05-31 19:05:05 +07:00
refactor: preserve extension ID case in DownloadByStrategy, only lowercase built-in providers
This commit is contained in:
parent
c35a8dd803
commit
b6574f0097
1 changed files with 10 additions and 4 deletions
|
|
@ -412,15 +412,21 @@ func DownloadByStrategy(requestJSON string) (string, error) {
|
|||
return errorResponse("Invalid request: " + err.Error())
|
||||
}
|
||||
|
||||
service := strings.TrimSpace(strings.ToLower(req.Service))
|
||||
req.Service = service
|
||||
normalizedBytes, err := json.Marshal(req)
|
||||
serviceRaw := strings.TrimSpace(req.Service)
|
||||
serviceNormalized := strings.ToLower(serviceRaw)
|
||||
|
||||
normalizedReq := req
|
||||
if serviceNormalized == "youtube" || isBuiltInProvider(serviceNormalized) {
|
||||
normalizedReq.Service = serviceNormalized
|
||||
}
|
||||
|
||||
normalizedBytes, err := json.Marshal(normalizedReq)
|
||||
if err != nil {
|
||||
return errorResponse("Invalid request: " + err.Error())
|
||||
}
|
||||
normalizedJSON := string(normalizedBytes)
|
||||
|
||||
if service == "youtube" {
|
||||
if serviceNormalized == "youtube" {
|
||||
return DownloadFromYouTube(normalizedJSON)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue