mirror of https://github.com/Xhofe/alist
* Add support for Microsoft WebDAV * add importpull/6144/head
parent
71e4e1ab6e
commit
f8b1f87a5f
|
@ -14,6 +14,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/model"
|
"github.com/alist-org/alist/v3/internal/model"
|
||||||
|
@ -385,6 +386,10 @@ func findLastModified(ctx context.Context, ls LockSystem, name string, fi model.
|
||||||
return fi.ModTime().UTC().Format(http.TimeFormat), nil
|
return fi.ModTime().UTC().Format(http.TimeFormat), nil
|
||||||
}
|
}
|
||||||
func findCreationDate(ctx context.Context, ls LockSystem, name string, fi model.Obj) (string, error) {
|
func findCreationDate(ctx context.Context, ls LockSystem, name string, fi model.Obj) (string, error) {
|
||||||
|
userAgent := ctx.Value("userAgent").(string)
|
||||||
|
if strings.Contains(strings.ToLower(userAgent), "microsoft-webdav") {
|
||||||
|
return fi.CreateTime().UTC().Format(http.TimeFormat), nil
|
||||||
|
}
|
||||||
return fi.CreateTime().UTC().Format(time.RFC3339), nil
|
return fi.CreateTime().UTC().Format(time.RFC3339), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package webdav // import "golang.org/x/net/webdav"
|
package webdav // import "golang.org/x/net/webdav"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -619,6 +620,8 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
|
||||||
return status, err
|
return status, err
|
||||||
}
|
}
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
|
userAgent := r.Header.Get("User-Agent")
|
||||||
|
ctx = context.WithValue(ctx, "userAgent", userAgent)
|
||||||
user := ctx.Value("user").(*model.User)
|
user := ctx.Value("user").(*model.User)
|
||||||
reqPath, err = user.JoinPath(reqPath)
|
reqPath, err = user.JoinPath(reqPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue