From df13d57a045fd5da959aec6ec86f4d2f1d3c773b Mon Sep 17 00:00:00 2001 From: milankonir Date: Thu, 11 Jan 2024 10:18:14 +0100 Subject: [PATCH] format mod date in utc --- Makefile | 2 +- encode.go | 2 +- testdata/encode/part-default-headers.golden | 2 +- testdata/encode/part-file-mod-date.golden | 2 +- testdata/encode/part-quoted-headers.golden | 2 +- testdata/encode/part-quoted-printable-headers.golden | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 59fa611b..892d01b7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ build: go build test: - TZ=Europe/London go test -race ./... + go test -race ./... fmt: @gofmt -l -w $(SRC) diff --git a/encode.go b/encode.go index 6a23662e..b0f09a7e 100644 --- a/encode.go +++ b/encode.go @@ -154,7 +154,7 @@ func (p *Part) setupMIMEHeaders() transferEncoding { param := make(map[string]string) setParamValue(param, hpFilename, fileName) if !p.FileModDate.IsZero() { - setParamValue(param, hpModDate, p.FileModDate.Format(time.RFC822)) + setParamValue(param, hpModDate, p.FileModDate.UTC().Format(time.RFC822)) } if mt := mime.FormatMediaType(p.Disposition, param); mt != "" { p.Disposition = mt diff --git a/testdata/encode/part-default-headers.golden b/testdata/encode/part-default-headers.golden index 59686cb6..6fca8c4c 100644 --- a/testdata/encode/part-default-headers.golden +++ b/testdata/encode/part-default-headers.golden @@ -1,5 +1,5 @@ Content-Disposition: attachment; filename=stuff.zip; modification-date="01 - Feb 03 04:05 GMT" + Feb 03 04:05 UTC" Content-Id: Content-Transfer-Encoding: base64 Content-Type: application/zip; boundary=enmime-abcdefg0123456789; diff --git a/testdata/encode/part-file-mod-date.golden b/testdata/encode/part-file-mod-date.golden index 691fdb14..556bd6b0 100644 --- a/testdata/encode/part-file-mod-date.golden +++ b/testdata/encode/part-file-mod-date.golden @@ -1,4 +1,4 @@ -Content-Disposition: inline; modification-date="01 Feb 03 04:05 GMT" +Content-Disposition: inline; modification-date="01 Feb 03 04:05 UTC" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 diff --git a/testdata/encode/part-quoted-headers.golden b/testdata/encode/part-quoted-headers.golden index d3278bac..910a854d 100644 --- a/testdata/encode/part-quoted-headers.golden +++ b/testdata/encode/part-quoted-headers.golden @@ -1,6 +1,6 @@ Content-Disposition: attachment; filename="=?utf-8?b?w6FydsOtenTFsXLFkSAieCIgdMO8a8O2cmbDunLDs2fDqXAuemlw?="; - modification-date="01 Feb 03 04:05 GMT" + modification-date="01 Feb 03 04:05 UTC" Content-Id: Content-Transfer-Encoding: base64 Content-Type: application/zip; boundary=enmime-abcdefg0123456789; diff --git a/testdata/encode/part-quoted-printable-headers.golden b/testdata/encode/part-quoted-printable-headers.golden index d8dd3022..73cc5b19 100644 --- a/testdata/encode/part-quoted-printable-headers.golden +++ b/testdata/encode/part-quoted-printable-headers.golden @@ -1,6 +1,6 @@ Content-Disposition: attachment; filename="=?utf-8?b?w6FydsOtenTFsXLFkSAieCIgdMO8a8O2cmbDunLDs2fDqXAuemlw?="; - modification-date="01 Feb 03 04:05 GMT" + modification-date="01 Feb 03 04:05 UTC" Content-Id: Content-Transfer-Encoding: base64 Content-Type: application/zip; boundary=enmime-abcdefg0123456789;