diff options
| author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2026-11-10 18:03:37 +0100 |
|---|---|---|
| committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2026-11-10 18:03:51 +0100 |
| commit | 0738cfbbdbbf898d9e864970924e59d0a2af45e3 (patch) | |
| tree | faf2d31bf4438fcf25c9f50f5b87b0d14e65902a /iterator.go | |
| parent | 537dbec6f63eff137a582dc4e8e7a06d20083237 (diff) | |
| download | go-schwift-0738cfbbdbbf898d9e864970924e59d0a2af45e3.tar.gz | |
Fix that Ceph Swift API emulation contains timezone
Diffstat (limited to 'iterator.go')
| -rw-r--r-- | iterator.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/iterator.go b/iterator.go index c566f59..9938404 100644 --- a/iterator.go +++ b/iterator.go @@ -9,8 +9,18 @@ import ( "net/http" "strconv" "strings" + "time" ) +func parseSwiftLastModified(value string) (time.Time, error) { + // Swift listings traditionally omit the timezone, which is implicitly UTC. + // Some Swift-compatible APIs include a timezone, so try the value as-is first. + if parsed, err := time.Parse(time.RFC3339Nano, value); err == nil { + return parsed, nil + } + return time.Parse(time.RFC3339Nano, value+"Z") +} + // iteratorInterface allows iteratorBase to access public attributes of // ContainerIterator/ObjectIterator. type iteratorInterface interface { |
