mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 16:39:41 -05:00
17 lines
328 B
Go
17 lines
328 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/gtsteffaniak/filebrowser/backend/pkg/indexing"
|
|
)
|
|
|
|
func denyIfSourceReadOnly(sourceName string) (int, error) {
|
|
idx := indexing.GetIndex(sourceName)
|
|
if idx != nil && idx.Config.ReadOnly {
|
|
return http.StatusForbidden, fmt.Errorf("source is read-only")
|
|
}
|
|
return 0, nil
|
|
}
|