From 71bf2b2b61119a0846df6ee5ad3f3c1e2ab36630 Mon Sep 17 00:00:00 2001 From: Sami Sallam Date: Wed, 29 Jul 2026 16:54:40 +0200 Subject: [PATCH] Display object Last Modified times in the local timezone Render Last Modified using time.Local and a stable timestamp format so operators can set TZ (for example Europe/Berlin) and see wall-clock times instead of always UTC. Embed time/tzdata and install tzdata in the image so timezone data is available in minimal container environments. --- Dockerfile | 3 ++- README.md | 1 + main.go | 1 + web/template/bucket.html.tmpl | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c82884ae..bfb5fd38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,8 @@ WORKDIR /usr/src/app RUN addgroup -S s3manager && adduser -S s3manager -G s3manager RUN apk add --no-cache \ ca-certificates \ - dumb-init + dumb-init \ + tzdata COPY --from=builder --chown=s3manager:s3manager /usr/src/app/bin/s3manager ./ USER s3manager EXPOSE 8080 diff --git a/README.md b/README.md index dfdd6fdf..a1c8e13e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The application can be configured with the following environment variables: - `ALLOW_DELETE`: Enable buttons to delete objects (defaults to `true`) - `FORCE_DOWNLOAD`: Add response headers for object downloading instead of opening in a new tab (defaults to `true`) - `LIST_RECURSIVE`: List all objects in buckets recursively (defaults to `false`) +- `TZ`: IANA timezone used when displaying object Last Modified times (defaults to UTC; for example `Europe/Berlin`) - `BUCKET_NAME`: Restrict the buckets view to a single named bucket (defaults to unset, showing all buckets) - `USE_IAM`: Use IAM role instead of key pair (defaults to `false`) - `IAM_ENDPOINT`: Endpoint for IAM role retrieving (Can be blank for AWS) diff --git a/main.go b/main.go index aba499f6..a0c5c58b 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "os" "strings" "time" + _ "time/tzdata" "github.com/cloudlena/adapters/logging" "github.com/cloudlena/s3manager/internal/app/s3manager" diff --git a/web/template/bucket.html.tmpl b/web/template/bucket.html.tmpl index 0046be93..37fb3925 100644 --- a/web/template/bucket.html.tmpl +++ b/web/template/bucket.html.tmpl @@ -216,7 +216,7 @@ {{ $object.SizeDisplay }} {{ $object.Owner }} - {{ $object.LastModified }} + {{ $object.LastModified.Local.Format "2006-01-02 15:04:05 MST" }} {{ if not $object.IsFolder }}