mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-05-05 19:59:29 -05:00
[server] Remove name conflict prefix
This commit is contained in:
@@ -137,7 +137,7 @@ func props(fs FileSystem, ls LockSystem, fi serve.ResourceInfo, pnames []xml.Nam
|
||||
pstatNotFound := Propstat{Status: http.StatusNotFound}
|
||||
for _, pn := range pnames {
|
||||
// Otherwise, it must either be a live property or we don't know it.
|
||||
if prop := liveProps[pn]; prop.findFn != nil && (prop.dir || !fi.FSDir()) {
|
||||
if prop := liveProps[pn]; prop.findFn != nil && (prop.dir || !fi.Dir()) {
|
||||
innerXML := prop.findFn(fi)
|
||||
pstatOK.Props = append(pstatOK.Props, Property{
|
||||
XMLName: pn,
|
||||
@@ -156,7 +156,7 @@ func props(fs FileSystem, ls LockSystem, fi serve.ResourceInfo, pnames []xml.Nam
|
||||
func propnames(fs FileSystem, ls LockSystem, fi serve.ResourceInfo) ([]xml.Name, error) {
|
||||
pnames := make([]xml.Name, 0, len(liveProps))
|
||||
for pn, prop := range liveProps {
|
||||
if prop.findFn != nil && (prop.dir || !fi.FSDir()) {
|
||||
if prop.findFn != nil && (prop.dir || !fi.Dir()) {
|
||||
pnames = append(pnames, pn)
|
||||
}
|
||||
}
|
||||
@@ -253,34 +253,34 @@ func escapeXML(s string) string {
|
||||
}
|
||||
|
||||
func findResourceType(fi serve.ResourceInfo) string {
|
||||
if fi.FSDir() {
|
||||
if fi.Dir() {
|
||||
return `<D:collection xmlns:D="DAV:"/>`
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func findDisplayName(fi serve.ResourceInfo) string {
|
||||
return escapeXML(fi.FSName())
|
||||
return escapeXML(fi.Name())
|
||||
}
|
||||
|
||||
func findContentLength(fi serve.ResourceInfo) string {
|
||||
return strconv.FormatInt(fi.FSContentSize(), 10)
|
||||
return strconv.FormatInt(fi.ContentSize(), 10)
|
||||
}
|
||||
|
||||
func findCreationDate(fi serve.ResourceInfo) string {
|
||||
return fi.FSCreated().UTC().Format(http.TimeFormat)
|
||||
return fi.Created().UTC().Format(http.TimeFormat)
|
||||
}
|
||||
|
||||
func findLastModified(fi serve.ResourceInfo) string {
|
||||
return fi.FSModified().UTC().Format(http.TimeFormat)
|
||||
return fi.Modified().UTC().Format(http.TimeFormat)
|
||||
}
|
||||
|
||||
func findContentType(fi serve.ResourceInfo) string {
|
||||
return fi.FSContentType()
|
||||
return fi.ContentType()
|
||||
}
|
||||
|
||||
func findETag(fi serve.ResourceInfo) string {
|
||||
return fi.FSContentSHA256()
|
||||
return fi.ContentSHA256()
|
||||
}
|
||||
|
||||
func findSupportedLock(fi serve.ResourceInfo) string {
|
||||
|
||||
@@ -167,7 +167,7 @@ func (h *Handler) confirmLocks(r *http.Request, src, dst string) (release func()
|
||||
if res, err := h.FileSystem.ResourceByPath(path); err != nil {
|
||||
return false, err
|
||||
} else {
|
||||
return res.FSContentSHA256() == etag, nil
|
||||
return res.ContentSHA256() == etag, nil
|
||||
}
|
||||
}, l.conditions...)
|
||||
if err == ErrConfirmationFailed {
|
||||
@@ -192,7 +192,7 @@ func (h *Handler) handleOptions(w http.ResponseWriter, r *http.Request) (status
|
||||
}
|
||||
allow := "OPTIONS, LOCK, PUT, MKCOL"
|
||||
if fi, err := h.FileSystem.ResourceByPath(reqPath); err == nil {
|
||||
if fi.FSDir() {
|
||||
if fi.Dir() {
|
||||
allow = "OPTIONS, LOCK, DELETE, PROPPATCH, COPY, MOVE, UNLOCK, PROPFIND"
|
||||
} else {
|
||||
allow = "OPTIONS, LOCK, GET, HEAD, POST, DELETE, PROPPATCH, COPY, MOVE, UNLOCK, PROPFIND, PUT"
|
||||
@@ -268,7 +268,7 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
|
||||
}
|
||||
} else if err != nil {
|
||||
return http.StatusNotFound, err
|
||||
} else if res.FSDir() {
|
||||
} else if res.Dir() {
|
||||
return http.StatusConflict, fs.ErrResourceCollection
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
|
||||
if closeErr != nil {
|
||||
return http.StatusMethodNotAllowed, closeErr
|
||||
}
|
||||
w.Header().Set("ETag", fi.FSContentSHA256())
|
||||
w.Header().Set("ETag", fi.ContentSHA256())
|
||||
return http.StatusCreated, nil
|
||||
}
|
||||
|
||||
@@ -476,8 +476,8 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
href := path.Join(h.Prefix, r.FSPath())
|
||||
if href != "/" && r.FSDir() {
|
||||
href := path.Join(h.Prefix, r.Path())
|
||||
if href != "/" && r.Dir() {
|
||||
href += "/"
|
||||
}
|
||||
return mw.write(makePropstatResponse(href, pstats))
|
||||
|
||||
Reference in New Issue
Block a user