Use fileutils instead

This commit is contained in:
Henrique Dias
2017-07-27 21:39:23 +01:00
parent dac92eec8b
commit ff034f7e8f
8 changed files with 17 additions and 247 deletions

View File

@@ -10,13 +10,13 @@ import (
"path/filepath"
"strings"
"github.com/hacdias/filemanager/dir"
"github.com/hacdias/fileutils"
)
// sanitizeURL sanitizes the URL to prevent path transversal
// using dir.SlashClean and adds the trailing slash bar.
// using fileutils.SlashClean and adds the trailing slash bar.
func sanitizeURL(url string) string {
path := dir.SlashClean(url)
path := fileutils.SlashClean(url)
if strings.HasSuffix(url, "/") && path != "/" {
return path + "/"
}