summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-10-29 02:55:46 +0100
committerache <ache@ache.one>2019-10-29 02:55:46 +0100
commit80711be93e58c0bc173628dbbbd338694d330bf5 (patch)
tree98727683f02e3cafb402bcd2562559ddaf287de3
parentDev config (diff)
Use template for xml
-rw-r--r--xml.tmpl33
1 files changed, 33 insertions, 0 deletions
diff --git a/xml.tmpl b/xml.tmpl
new file mode 100644
index 0000000..1b67212
--- /dev/null
+++ b/xml.tmpl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:multistatus xmlns:D="DAV:">
+<D:response>
+<D:href>{{ .Href }}</D:href>
+<D:propstat>
+<D:prop>
+<D:displayname>{{ .Name }}</D:displayname>
+<D:getlastmodified>{{ .Date }}</D:getlastmodified>
+<D:resourcetype><D:collection/></D:resourcetype>
+<D:lockdiscovery/>
+<D:supportedlock>
+</D:supportedlock>
+</D:prop>
+<D:status>HTTP/1.1 200 OK</D:status>
+</D:propstat>
+</D:response>
+{{range .ListFiles}}<D:response>
+<D:href>{{ .Href }}</D:href>
+<D:propstat>
+<D:prop>
+<D:displayname>{{ .DisplayName }}</D:displayname>
+<D:getcontentlength>{{ .Size }}</D:getcontentlength>
+<D:getlastmodified>{{ .LastModifier }}</D:getlastmodified>
+<D:resourcetype>{{ if .IsDir }}<D:collection/>{{end}}</D:resourcetype>
+<D:lockdiscovery/>
+<D:supportedlock>
+</D:supportedlock>
+</D:prop>
+<D:status>HTTP/1.1 {{ .Status }}</D:status>
+</D:propstat>
+</D:response>
+{{end}}
+</D:multistatus>