mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-20 00:47:00 +08:00
Refactors Static() file serving
This commit is contained in:
11
utils.go
11
utils.go
@ -2,7 +2,6 @@ package gin
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"path"
|
||||
)
|
||||
|
||||
type H map[string]interface{}
|
||||
@ -31,16 +30,6 @@ func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func joinGroupPath(elems ...string) string {
|
||||
joined := path.Join(elems...)
|
||||
lastComponent := elems[len(elems)-1]
|
||||
// Append a '/' if the last component had one, but only if it's not there already
|
||||
if len(lastComponent) > 0 && lastComponent[len(lastComponent)-1] == '/' && joined[len(joined)-1] != '/' {
|
||||
return joined + "/"
|
||||
}
|
||||
return joined
|
||||
}
|
||||
|
||||
func filterFlags(content string) string {
|
||||
for i, a := range content {
|
||||
if a == ' ' || a == ';' {
|
||||
|
Reference in New Issue
Block a user