MCPcopy
hub / github.com/gtsteffaniak/filebrowser / Stat

Method Stat

backend/http/webdav.go:336–361  ·  view source on GitHub ↗
(ctx context.Context, requestPath string)

Source from the content-addressed store, hash-verified

334}
335
336func (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.
364func webDAVHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {

Callers 15

OpenFileMethod · 0.80
unarchiveHandlerFunction · 0.80
addFileFunction · 0.80
addSingleFileFunction · 0.80
BuildAndStreamArchiveFunction · 0.80
rawFilesHandlerFunction · 0.80
readLastNLinesFunction · 0.80
fileWatchHandlerFunction · 0.80
fileWatchSSEHandlerFunction · 0.80
sendFileWatchUpdateFunction · 0.80
staticAssetHandlerFunction · 0.80
validateMoveOperationFunction · 0.80

Calls 2

getFileInfoMethod · 0.95
checkAccessMethod · 0.95

Tested by 4

fileExistsFunction · 0.64