Add more metadata

This commit is contained in:
Ben Sarmiento
2023-10-17 12:36:33 +02:00
parent c5f365c8b4
commit 44216343e2
9 changed files with 139 additions and 39 deletions

View File

@@ -6,9 +6,17 @@ import (
)
func customPathEscape(input string) string {
// First, URL-escape the path segments
segments := strings.Split(input, "/")
for i, segment := range segments {
segments[i] = url.PathEscape(segment)
}
return strings.Join(segments, "/")
escapedPath := strings.Join(segments, "/")
// Convert any XML-escaped sequences back to URL-escaped sequences
escapedPath = strings.Replace(escapedPath, "&", "%26", -1) // for &
escapedPath = strings.Replace(escapedPath, "<", "%3C", -1) // for <
escapedPath = strings.Replace(escapedPath, ">", "%3E", -1) // for >
escapedPath = strings.Replace(escapedPath, "\"", "%22", -1) // for "
escapedPath = strings.Replace(escapedPath, "'", "%27", -1) // for '
return escapedPath
}