mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(webconsole): sftp download utf8 filename (#19708)
This commit is contained in:
@@ -20,8 +20,10 @@ import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -245,7 +247,7 @@ func HandleSftpDownload(ctx context.Context, w http.ResponseWriter, r *http.Requ
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
w.Header().Add("Content-Disposition", "attachment;filename="+file.Name())
|
||||
w.Header().Add("Content-Disposition", "attachment;filename*=utf-8''"+strings.ReplaceAll(url.QueryEscape(file.Name()), "+", "%20"))
|
||||
w.Header().Add("Content-Type", "application/octet-stream")
|
||||
_, err = io.Copy(w, reader)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user