From cf40cf2b3e2371b10e34c512437aaacd550fa570 Mon Sep 17 00:00:00 2001 From: Palapeli <26661008+mkwcat@users.noreply.github.com> Date: Tue, 7 Apr 2026 22:43:01 -0400 Subject: [PATCH] NAS: Fix /download endpoint --- nas/dlc.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nas/dlc.go b/nas/dlc.go index be5c0cc..bacfda5 100644 --- a/nas/dlc.go +++ b/nas/dlc.go @@ -40,7 +40,12 @@ func handleDownloadEndpoint(w http.ResponseWriter, r *http.Request) { if actionFunc, exists := dlsActions[action]; exists { reply := actionFunc(moduleName, fields) - writeAuthResponse(w, reply) + w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Content-Length", strconv.Itoa(len(reply))) + _, err := w.Write(reply) + if err != nil { + logging.Error(moduleName, "Error writing response:", err) + } return } @@ -48,8 +53,8 @@ func handleDownloadEndpoint(w http.ResponseWriter, r *http.Request) { replyHTTPError(w, 400, "400 Bad Request") } -func dlsCount(moduleName string, fields map[string]string) []byte { - dlcFolder := filepath.Join(dlcDir, fields["rhgamecd"]) +func dlsCount(moduleName string, fields map[string][]byte) []byte { + dlcFolder := filepath.Join(dlcDir, string(fields["rhgamecd"])) dir, err := os.ReadDir(dlcFolder) if err != nil {