Fix purging default file from HTTP cache

This commit is contained in:
Ingo Oppermann 2023-04-03 10:27:04 +02:00
parent 48678fb4c6
commit 6eefa5ca2b
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -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())