mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Update whitelist for sytest media fix (#1137)
* Update sytest-whitelist, are-we-synapse-yet.list * Update gomatrixserverlib * Update gomatrixserverlib * Loop avoidance * Return UTF-8 filenames * Replace quotes only, instead of using strconv.Quote * Update sytest-whitelist * Update sytest-whitelist
This commit is contained in:
parent
e15a8042a1
commit
04c99092a4
6 changed files with 43 additions and 8 deletions
|
@ -21,6 +21,7 @@ import (
|
|||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -302,7 +303,14 @@ func (r *downloadRequest) respondFromLocalFile(
|
|||
responseMetadata = r.MediaMetadata
|
||||
|
||||
if len(responseMetadata.UploadName) > 0 {
|
||||
w.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename*=utf-8"%s"`, responseMetadata.UploadName))
|
||||
uploadName, err := url.PathUnescape(string(responseMetadata.UploadName))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("url.PathUnescape: %w", err)
|
||||
}
|
||||
w.Header().Set("Content-Disposition", fmt.Sprintf(
|
||||
`inline; filename=utf-8"%s"`,
|
||||
strings.ReplaceAll(uploadName, `"`, `\"`), // escape quote marks only, as per RFC6266
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue