0

fix: add ETag header for bot/scraper page. For #4020

This commit is contained in:
Gabe Kangas 2024-12-18 07:28:06 -08:00
parent f59278764b
commit a38c2d8ddf

View File

@ -2,6 +2,7 @@ package handlers
import (
"bytes"
"crypto/md5" // nolint:gosec
"encoding/json"
"fmt"
"net/http"
@ -199,7 +200,7 @@ func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) {
// Set a cache header
middleware.SetCachingHeaders(w, r)
w.Header().Set("ETag", fmt.Sprintf("%x", md5.Sum(b.Bytes()))) // nolint:gosec
w.Header().Set("Content-Type", "text/html")
if _, err = w.Write(b.Bytes()); err != nil {
log.Errorln(err)