MCPcopy Create free account
hub / github.com/tailscale/tailscale / fileInfoToStatic

Function fileInfoToStatic

drive/driveimpl/drive_test.go:719–736  ·  view source on GitHub ↗
(fi fs.FileInfo, fixupMode bool)

Source from the content-addressed store, hash-verified

717}
718
719func fileInfoToStatic(fi fs.FileInfo, fixupMode bool) fs.FileInfo {
720 mode := fi.Mode()
721 if fixupMode {
722 // WebDAV doesn't transmit file modes, so we just mimic the defaults that
723 // our WebDAV client uses.
724 mode = os.FileMode(0664)
725 if fi.IsDir() {
726 mode = 0775 | os.ModeDir
727 }
728 }
729 return &shared.StaticFileInfo{
730 Named: fi.Name(),
731 Sized: fi.Size(),
732 Moded: mode,
733 ModdedTime: fi.ModTime().Truncate(1 * time.Second).UTC(),
734 Dir: fi.IsDir(),
735 }
736}
737
738func pathTo(remote, share, name string) string {
739 return path.Join(domain, remote, share, name)

Callers 1

checkFileInfosEqualMethod · 0.85

Calls 6

ModeMethod · 0.80
ModTimeMethod · 0.80
NameMethod · 0.65
TruncateMethod · 0.65
IsDirMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…