You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(base): Key.Expires() returns 1970-01-01 for keys with no expiration #244
b2_create_key and b2_list_keys return expirationTimestamp: null for an application key with no expiration (b2_list_keys). Blazer decodes that as 0, and millitime (base/base.go:367) converts it to time.Unix(0, 0). Both paths use it: base/base.go:2089 (create) and base/base.go:2126 (list).
So Key.Expires() returns 1970-01-01T00:00:00Z with IsZero() == false. A caller can't tell "never expires" from "expired in 1970". Code that checks k.Expires().IsZero() for "no expiration" treats every such key as expired.
Reproduction
A b2_list_keys response with "expirationTimestamp": null for a key, then Client.ListKeys: Expires() on that key returns 1970-01-01, not the zero time.Time.
Expected
A key with no expiration returns the zero time.Time from Key.Expires().
Acceptance criteria
A null or missing expirationTimestamp maps to time.Time{} in both the create and the list paths.
A wire test with the documented null fixture asserts Expires().IsZero(), and it fails before the fix.
The Key.Expires() godoc says what the zero value means.
Changelog entry under Fixed.
Out of scope
Other millitime call sites (upload timestamps and so on), unless the same null case applies there; note them if found.
Activity