From ba0a1a651eebcaf588ec713ed0fa63a085309b75 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 29 Nov 2020 16:13:07 -0700 Subject: [PATCH] Only use the permission bits for ModeBits --- server/filesystem/stat.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/filesystem/stat.go b/server/filesystem/stat.go index a7465c8..a6c014d 100644 --- a/server/filesystem/stat.go +++ b/server/filesystem/stat.go @@ -26,11 +26,12 @@ func (s *Stat) MarshalJSON() ([]byte, error) { Symlink bool `json:"symlink"` Mime string `json:"mime"` }{ - Name: s.Info.Name(), - Created: s.CTime().Format(time.RFC3339), - Modified: s.Info.ModTime().Format(time.RFC3339), - Mode: s.Info.Mode().String(), - ModeBits: strconv.FormatUint(uint64(s.Info.Mode()), 8), + Name: s.Info.Name(), + Created: s.CTime().Format(time.RFC3339), + Modified: s.Info.ModTime().Format(time.RFC3339), + Mode: s.Info.Mode().String(), + // Using `&os.ModePerm` on the file's mode will cause the mode to only have the permission values, and nothing else. + ModeBits: strconv.FormatUint(uint64(s.Info.Mode()&os.ModePerm), 8), Size: s.Info.Size(), Directory: s.Info.IsDir(), File: !s.Info.IsDir(),