Add more metadata
This commit is contained in:
@@ -12,7 +12,7 @@ func Directory(path string) Response {
|
||||
}
|
||||
}
|
||||
|
||||
func File(path string, fileSize int, added string, link string) Response {
|
||||
func File(path string, fileSize int64, added string, link string) Response {
|
||||
return Response{
|
||||
Href: customPathEscape(path),
|
||||
Propstat: PropStat{
|
||||
|
||||
@@ -20,7 +20,7 @@ type PropStat struct {
|
||||
|
||||
type Prop struct {
|
||||
ResourceType ResourceType `xml:"d:resourcetype"`
|
||||
ContentLength int `xml:"d:getcontentlength"`
|
||||
ContentLength int64 `xml:"d:getcontentlength"`
|
||||
CreationDate string `xml:"d:creationdate"`
|
||||
LastModified string `xml:"d:getlastmodified"`
|
||||
IsHidden int `xml:"d:ishidden"`
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user