| 254 | } |
| 255 | |
| 256 | func withRootNamespace(cfg dropbox.Config, tokType string) dropbox.Config { |
| 257 | // Team manage tokens are for administrative operations and don't need a path root. |
| 258 | if tokType == tokenTeamManage { |
| 259 | return cfg |
| 260 | } |
| 261 | |
| 262 | account, err := usersNewFunc(cfg).GetCurrentAccountContext(currentContext()) |
| 263 | if err != nil { |
| 264 | cfg.LogInfo("Warning: could not auto-detect root namespace (%v); team folders may not be accessible", err) |
| 265 | return cfg |
| 266 | } |
| 267 | |
| 268 | rootNamespaceID := rootNamespaceID(account) |
| 269 | if rootNamespaceID == "" { |
| 270 | return cfg |
| 271 | } |
| 272 | return cfg.WithRoot(rootNamespaceID) |
| 273 | } |
| 274 | |
| 275 | func rootNamespaceID(account *users.FullAccount) string { |
| 276 | if account == nil { |