(ctx context.Context, path string, _ int, _ os.FileMode)
| 185 | } |
| 186 | |
| 187 | func (w *webdavFS) OpenFile(ctx context.Context, path string, _ int, _ os.FileMode) (webdav.File, error) { |
| 188 | f, err := w.findEntry(ctx, path) |
| 189 | if err != nil { |
| 190 | log(ctx).Errorf("OpenFile(%q) failed with %v", path, err) |
| 191 | return nil, err |
| 192 | } |
| 193 | |
| 194 | switch f := f.(type) { |
| 195 | case fs.Directory: |
| 196 | iter, err := f.Iterate(ctx) |
| 197 | if err != nil { |
| 198 | return nil, err //nolint:wrapcheck |
| 199 | } |
| 200 | |
| 201 | return &webdavDir{ctx, w, webdavFileInfo{f}, iter}, nil |
| 202 | case fs.File: |
| 203 | return &webdavFile{ctx: ctx, entry: f}, nil |
| 204 | } |
| 205 | |
| 206 | return nil, errors.Errorf("can't open %q: not implemented", path) |
| 207 | } |
| 208 | |
| 209 | func (w *webdavFS) Stat(ctx context.Context, path string) (os.FileInfo, error) { |
| 210 | e, err := w.findEntry(ctx, path) |
no test coverage detected