diff options
| author | Oskari Saarenmaa | 2017-02-14 21:52:26 +0200 |
|---|---|---|
| committer | Oskari Saarenmaa | 2017-02-15 00:14:54 +0200 |
| commit | 2aa4234efa6e04fdeee3129acdaa3464aa170dcd (patch) | |
| tree | 9e53427d0ff6510843d5b53efe9d0aa893235de6 | |
| parent | c7ad97798acefc2f801393d5bf59876386954f46 (diff) | |
| download | gdrive-2aa4234efa6e04fdeee3129acdaa3464aa170dcd.tar.bz2 | |
auth/file_source: don't try to read non-existent files
Commit b33b3e96e introduced a bug where we try to read a token file even if
it doesn't exist, causing unauthenticated run (e.g. `gdrive about`) to fail
with the error
Failed getting oauth client: Failed to read token: unexpected end of JSON input
Closes #257.
| -rw-r--r-- | auth/file_source.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/auth/file_source.go b/auth/file_source.go index 11e7325..9223d1d 100644 --- a/auth/file_source.go +++ b/auth/file_source.go @@ -47,7 +47,7 @@ func ReadFile(path string) ([]byte, bool, error) { func ReadToken(path string) (*oauth2.Token, bool, error) { content, exists, err := ReadFile(path) - if err != nil { + if err != nil || exists == false { return nil, exists, err } |
