From 4e708e59f2e21c9751e7023925071a2689a73d0f Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:01:30 +0200 Subject: [PATCH] local: fix incorrect conversion between integer types --- backend/local/metadata.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/local/metadata.go b/backend/local/metadata.go index 39b88dbdc..7ab69af30 100644 --- a/backend/local/metadata.go +++ b/backend/local/metadata.go @@ -129,10 +129,13 @@ func (o *Object) writeMetadataToFile(m fs.Metadata) (outErr error) { } mode, hasMode := o.parseMetadataInt(m, "mode", 8) if hasMode { - if mode >= 0 && uint(mode) <= math.MaxUint32 { - err = os.Chmod(o.path, os.FileMode(mode)) - if err != nil { - outErr = fmt.Errorf("failed to change permissions: %w", err) + if mode >= 0 { + umode := uint(mode) + if umode <= math.MaxUint32 { + err = os.Chmod(o.path, os.FileMode(umode)) + if err != nil { + outErr = fmt.Errorf("failed to change permissions: %w", err) + } } } }