diff options
| author | Percy Wegmann <percy@tailscale.com> | 2024-02-26 14:30:38 -0600 |
|---|---|---|
| committer | Percy Wegmann <percy@tailscale.com> | 2024-02-26 14:30:38 -0600 |
| commit | ffca8ae2b240012f8285e24fd4ca152be5d86906 (patch) | |
| tree | 60ada94ec7249dec7a25c6c5b8c5f782c894107b | |
| parent | 82c569a83a8cca619da6a85c8f1b9a5d81b08d92 (diff) | |
| download | tailscale-oxtoacart/immediately_access_shares.tar.xz tailscale-oxtoacart/immediately_access_shares.zip | |
Immediately access shares when adding themoxtoacart/immediately_access_shares
| -rw-r--r-- | ipn/ipnlocal/tailfs.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ipn/ipnlocal/tailfs.go b/ipn/ipnlocal/tailfs.go index d06599661..fc5e5e16f 100644 --- a/ipn/ipnlocal/tailfs.go +++ b/ipn/ipnlocal/tailfs.go @@ -80,6 +80,25 @@ func (b *LocalBackend) TailFSAddShare(share *tailfs.Share) error { return err } + // Make sure share is actually a directory. + dir, err := os.Open(share.Name) + if err != nil { + return err + } + fi, err := dir.Stat() + if err != nil { + return err + } + if !fi.IsDir() { + return fmt.Errorf("%q is not a directory", share.Name) + } + // Immediately access each share to prompt the user for file access on + // platforms that require it (e.g. MacOS sandboxed). + _, err = dir.ReadDir(1) + if err != nil { + return err + } + b.mu.Lock() shares, err := b.tailfsAddShareLocked(share) b.mu.Unlock() |
