From 6eefa5ca2b2dfc4a6d55974691a464eafafedc22 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 3 Apr 2023 10:27:04 +0200 Subject: [PATCH] Fix purging default file from HTTP cache --- http/handler/filesystem.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/http/handler/filesystem.go b/http/handler/filesystem.go index 54435238..9e00e37c 100644 --- a/http/handler/filesystem.go +++ b/http/handler/filesystem.go @@ -90,6 +90,13 @@ func (h *FSHandler) PutFile(c echo.Context) error { if h.fs.Cache != nil { h.fs.Cache.Delete(path) + + if len(h.fs.DefaultFile) != 0 { + if strings.HasSuffix(path, "/"+h.fs.DefaultFile) { + path := strings.TrimSuffix(path, h.fs.DefaultFile) + h.fs.Cache.Delete(path) + } + } } c.Response().Header().Set("Content-Location", req.URL.RequestURI())