符号链接支持,可以通过mklink(Windows)或者ln -s (Linux)将其他路径下的文件夹链接到根目录下而无需将文件复制到根目录下.针对删除场景特殊处理,删除整个符号链接目录不会删除链接目录内文件,仅删除链接,在符号链接目录操作同普通目录
This commit is contained in:
@ -177,7 +177,7 @@ func (h *Handler) handleOptions(w http.ResponseWriter, r *http.Request) (status
|
||||
ctx := r.Context()
|
||||
allow := "OPTIONS, LOCK, PUT, MKCOL"
|
||||
if fi, err := h.FileSystem.Stat(ctx, reqPath); err == nil {
|
||||
if fi.IsDir() {
|
||||
if fi.IsDir() || (fi.Mode()&os.ModeSymlink > 0) {
|
||||
allow = "OPTIONS, LOCK, DELETE, PROPPATCH, COPY, MOVE, UNLOCK, PROPFIND"
|
||||
} else {
|
||||
allow = "OPTIONS, LOCK, GET, HEAD, POST, DELETE, PROPPATCH, COPY, MOVE, UNLOCK, PROPFIND, PUT"
|
||||
@ -207,7 +207,7 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
|
||||
if err != nil {
|
||||
return http.StatusNotFound, err
|
||||
}
|
||||
if fi.IsDir() {
|
||||
if fi.IsDir() || (fi.Mode()&os.ModeSymlink > 0) {
|
||||
return http.StatusMethodNotAllowed, nil
|
||||
}
|
||||
etag, err := findETag(ctx, h.FileSystem, h.LockSystem, reqPath, fi)
|
||||
@ -557,7 +557,7 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
|
||||
return err
|
||||
}
|
||||
href := path.Join(h.Prefix, reqPath)
|
||||
if href != "/" && info.IsDir() {
|
||||
if href != "/" && (info.IsDir() || (info.Mode()&os.ModeSymlink > 0)) {
|
||||
href += "/"
|
||||
}
|
||||
return mw.write(MakePropstatResponse(href, pstats))
|
||||
|
Reference in New Issue
Block a user