| 334 | } |
| 335 | |
| 336 | func (ffs *filteredFileSystem) Stat(ctx context.Context, requestPath string) (os.FileInfo, error) { |
| 337 | // Try to get file info (uses cache if available, FileInfoFaster otherwise) |
| 338 | _, err := ffs.getFileInfo(requestPath, false) |
| 339 | if err == nil { |
| 340 | // Successfully got info - use underlying filesystem |
| 341 | return ffs.fs.Stat(ctx, requestPath) |
| 342 | } |
| 343 | |
| 344 | // Handle specific error cases |
| 345 | if errors.Is(err, commonerrors.ErrAccessDenied) || errors.Is(err, commonerrors.ErrNotViewable) { |
| 346 | return nil, os.ErrPermission |
| 347 | } |
| 348 | |
| 349 | // For not indexed, check if it's viewable |
| 350 | if errors.Is(err, commonerrors.ErrNotIndexed) { |
| 351 | // Use checkAccess to determine if viewable |
| 352 | if accessErr := ffs.checkAccess(requestPath); accessErr != nil { |
| 353 | return nil, os.ErrPermission |
| 354 | } |
| 355 | // Viewable - allow underlying filesystem |
| 356 | return ffs.fs.Stat(ctx, requestPath) |
| 357 | } |
| 358 | |
| 359 | // For other errors (like file not found), let underlying filesystem handle it |
| 360 | return ffs.fs.Stat(ctx, requestPath) |
| 361 | } |
| 362 | |
| 363 | // webDAVHandler serves WebDAV requests. |
| 364 | func webDAVHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) { |