Skip to content

Fail to parse time expirations #2649

Closed
Closed
@chmouel

Description

@chmouel

One token i have is getting this expiration from /rate_limit :

% export TOKEN=github_pat_*********;curl -v -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $TOKEN" https://api.github.com/rate_limit 2>&1|grep -n expiration
97:< github-authentication-token-expiration: 2023-04-26 23:23:18 +0200

the code that parse the token expiration here:

https://github.com/google/go-github/blob/a67a565/github/github.go#L677

is not working for me since :

2006-01-02 03:04:05 MST

would not parse that value,

on another token I get the expiration token as UTC:

github-authentication-token-expiration: 2023-01-31 23:00:00 UTC

the parsing would fail as well since it's not using a AM/PM thing. A parsing like that instead in this case would work :

"2006-01-02 15:04:05 MST"

I wonder if it's a misconfigured Github server and if we should handle all those use cases. All of those happen on public github not on public enteprise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions