MCPcopy Index your code
hub / github.com/labstack/echo / sanitizeURI

Function sanitizeURI

echo.go:927–934  ·  view source on GitHub ↗
(uri string)

Source from the content-addressed store, hash-verified

925}
926
927func sanitizeURI(uri string) string {
928 // double slash `\\`, `//` or even `\/` is absolute uri for browsers and by redirecting request to that uri
929 // we are vulnerable to open redirect attack. so replace all slashes from the beginning with single slash
930 if len(uri) > 1 && (uri[0] == '\\' || uri[0] == '/') && (uri[1] == '\\' || uri[1] == '/') {
931 uri = "/" + strings.TrimLeft(uri, `/\`)
932 }
933 return uri
934}

Callers 1

StaticDirectoryHandlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…