Skip to content

Commit

Permalink
auth/file_source: don't try to read non-existent files
Browse files Browse the repository at this point in the history
Commit b33b3e9 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 prasmussen#257.
  • Loading branch information
saaros committed Feb 14, 2017
1 parent c7ad977 commit 2aa4234
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion auth/file_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 2aa4234

Please sign in to comment.