SDK下载乱码问题修复

This commit is contained in:
robin
2026-03-04 19:44:21 +08:00
parent 30a1b4fa5e
commit c040d7c90d
6 changed files with 179 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package apps
import (
"net/url"
"os"
"path/filepath"
@@ -49,6 +50,6 @@ func (this *SdkDocAction) RunGet(params struct {
}
this.AddHeader("Content-Type", "text/markdown; charset=utf-8")
this.AddHeader("Content-Disposition", "attachment; filename=\""+downloadName+"\";")
this.AddHeader("Content-Disposition", "attachment; filename=\"sdk-doc.md\"; filename*=UTF-8''"+url.PathEscape(downloadName))
_, _ = this.ResponseWriter.Write(data)
}

View File

@@ -2,6 +2,7 @@ package apps
import (
"io"
"net/url"
"os"
"path/filepath"
@@ -58,7 +59,7 @@ func (this *SdkDownloadAction) RunGet(params struct {
this.AddHeader("X-SDK-Filename", downloadName)
} else {
this.AddHeader("Content-Type", "application/zip")
this.AddHeader("Content-Disposition", "attachment; filename=\""+downloadName+"\";")
this.AddHeader("Content-Disposition", "attachment; filename=\"sdk-download\"; filename*=UTF-8''"+url.PathEscape(downloadName))
}
this.AddHeader("X-Accel-Buffering", "no")
_, _ = io.Copy(this.ResponseWriter, fp)