From 355708adf218428568a3de382e055056742741bc Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 26 Mar 2024 11:39:57 +0300 Subject: [PATCH] More compact Base64 ETag --- cmd/sgblog/http.go | 4 ++-- common.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index 2e0c2d8..000037a 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -19,7 +19,7 @@ import ( "bytes" "crypto/sha1" _ "embed" - "encoding/hex" + "encoding/base64" "encoding/xml" "errors" "fmt" @@ -98,7 +98,7 @@ func makeA(href, text string) string { } func etagString(etag hash.Hash) string { - return `"` + hex.EncodeToString(etag.Sum(nil)) + `"` + return `"` + base64.RawURLEncoding.EncodeToString(etag.Sum(nil)) + `"` } func urlParse(what string) *url.URL { diff --git a/common.go b/common.go index 41ba4c3..e7ac217 100644 --- a/common.go +++ b/common.go @@ -30,7 +30,7 @@ import ( ) const ( - Version = "0.33.0" + Version = "0.34.0" WhenFmt = "2006-01-02 15:04:05Z07:00" ) -- 2.44.0