From 0738cfbbdbbf898d9e864970924e59d0a2af45e3 Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Tue, 10 Nov 2026 18:03:37 +0100 Subject: Fix that Ceph Swift API emulation contains timezone --- iterator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'iterator.go') 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 { -- cgit v1.3.1