Stat implements webdav.FileSystem.
(ctx context.Context, name string)
| 13 | |
| 14 | // Stat implements webdav.FileSystem. |
| 15 | func (dfs *FS) Stat(ctx context.Context, name string) (fs.FileInfo, error) { |
| 16 | nameWithoutStaticRoot, isStaticRoot := dfs.trimStaticRoot(name) |
| 17 | if isStaticRoot || shared.IsRoot(name) { |
| 18 | // Static root is a directory, always use now() as the modified time to |
| 19 | // bust caches. |
| 20 | fi := shared.ReadOnlyDirInfo(name, dfs.now()) |
| 21 | return fi, nil |
| 22 | } |
| 23 | |
| 24 | child := dfs.childFor(nameWithoutStaticRoot) |
| 25 | if child == nil { |
| 26 | return nil, &os.PathError{Op: "stat", Path: name, Err: os.ErrNotExist} |
| 27 | } |
| 28 | |
| 29 | return shared.ReadOnlyDirInfo(name, dfs.now()), nil |
| 30 | } |
no test coverage detected