Only use the permission bits for ModeBits

This commit is contained in:
Matthew Penner 2020-11-29 16:13:07 -07:00
parent 068f41393d
commit ba0a1a651e

View File

@ -30,7 +30,8 @@ func (s *Stat) MarshalJSON() ([]byte, error) {
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),
// 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(),