Merge pull request #5345 from mikix/chmod-enotsup

backend/local: ignore chmod "not supported" errors
This commit is contained in:
Michael Eischer
2025-07-21 22:28:53 +02:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -43,5 +43,12 @@ func isMacENOTTY(err error) bool {
// set file to readonly
func setFileReadonly(f string, mode os.FileMode) error {
return os.Chmod(f, mode&^0222)
err := os.Chmod(f, mode&^0222)
// ignore the error if the FS does not support setting this mode (e.g. CIFS with gvfs on Linux)
if err != nil && errors.Is(err, errors.ErrUnsupported) {
return nil
}
return err
}