22 lines
315 B
Go
22 lines
315 B
Go
package utils
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
func PathUnescape(path string) string {
|
|
|
|
// try to use url.PathUnescape
|
|
if unescaped, err := url.PathUnescape(path); err == nil {
|
|
return unescaped
|
|
}
|
|
|
|
// unescape %
|
|
unescapedPath := strings.ReplaceAll(path, "%25", "%")
|
|
|
|
// add others
|
|
|
|
return unescapedPath
|
|
}
|