mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 06:33:32 +08:00
Fix/parse upload filename (#6241)
* fix: parse filename in PUT + refactor * fix: master iu public url with http * fix: better parsing and handle disposition header * fix: take mime type from file extension if not set
This commit is contained in:
@@ -3,6 +3,7 @@ package master_ui
|
||||
import (
|
||||
_ "embed"
|
||||
"html/template"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed master.html
|
||||
@@ -11,5 +12,17 @@ var masterHtml string
|
||||
//go:embed masterNewRaft.html
|
||||
var masterNewRaftHtml string
|
||||
|
||||
var StatusTpl = template.Must(template.New("status").Parse(masterHtml))
|
||||
var templateFunctions = template.FuncMap{
|
||||
"url": func(input string) string {
|
||||
|
||||
if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
|
||||
return "http://" + input
|
||||
}
|
||||
|
||||
return input
|
||||
},
|
||||
}
|
||||
|
||||
var StatusTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterHtml))
|
||||
|
||||
var StatusNewRaftTpl = template.Must(template.New("status").Parse(masterNewRaftHtml))
|
||||
|
Reference in New Issue
Block a user