|
@@ -68,7 +68,7 @@ func (r *RouterDir) cleanPrefix(name string) string {
|
|
|
|
|
|
func (r *RouterDir) Mkdir(ctx context.Context, name string, perm os.FileMode) error {
|
|
func (r *RouterDir) Mkdir(ctx context.Context, name string, perm os.FileMode) error {
|
|
// Implement the Mkdir method
|
|
// Implement the Mkdir method
|
|
- return fmt.Errorf("Mkdir operation is not allowed: read-only file system")
|
|
|
|
|
|
+ return webdav.ErrForbidden
|
|
}
|
|
}
|
|
|
|
|
|
func (r *RouterDir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {
|
|
func (r *RouterDir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {
|
|
@@ -108,7 +108,7 @@ func (r *RouterDir) OpenFile(ctx context.Context, name string, flag int, perm os
|
|
fmt.Println("[Bokothumb]", "OpenFile called to "+name)
|
|
fmt.Println("[Bokothumb]", "OpenFile called to "+name)
|
|
// Check if the file is being opened with write permissions
|
|
// Check if the file is being opened with write permissions
|
|
if flag&(os.O_WRONLY|os.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 {
|
|
if flag&(os.O_WRONLY|os.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 {
|
|
- return nil, fmt.Errorf("write operations are not allowed: read-only file system")
|
|
|
|
|
|
+ return nil, webdav.ErrForbidden
|
|
}
|
|
}
|
|
return r.dir.OpenFile(ctx, name, flag, perm)
|
|
return r.dir.OpenFile(ctx, name, flag, perm)
|
|
}
|
|
}
|
|
@@ -122,7 +122,7 @@ func (r *RouterDir) RemoveAll(ctx context.Context, name string) error {
|
|
|
|
|
|
func (r *RouterDir) Rename(ctx context.Context, oldName, newName string) error {
|
|
func (r *RouterDir) Rename(ctx context.Context, oldName, newName string) error {
|
|
// Implement the Rename method
|
|
// Implement the Rename method
|
|
- return fmt.Errorf("Rename operation is not allowed: read-only file system")
|
|
|
|
|
|
+ return webdav.ErrForbidden
|
|
}
|
|
}
|
|
|
|
|
|
func (r *RouterDir) Stat(ctx context.Context, name string) (os.FileInfo, error) {
|
|
func (r *RouterDir) Stat(ctx context.Context, name string) (os.FileInfo, error) {
|