diff --git a/html/error.html b/html/error.html
index c84e12d..f1975f7 100644
--- a/html/error.html
+++ b/html/error.html
@@ -27,7 +27,7 @@
Sorry, but this page couldn't be served.
- We got an "%message%" error.
+ We got an "%message%"
We hope this isn't a problem on our end ;) - Make sure to check the troubleshooting section in the Docs!
diff --git a/server/gitea/cache.go b/server/gitea/cache.go
index 5808b07..8de2cd2 100644
--- a/server/gitea/cache.go
+++ b/server/gitea/cache.go
@@ -7,6 +7,8 @@ import (
"net/http"
"time"
+ "github.com/rs/zerolog/log"
+
"codeberg.org/codeberg/pages/server/cache"
)
@@ -97,10 +99,15 @@ func (t *writeCacheReader) Close() error {
func (f FileResponse) CreateCacheReader(r io.ReadCloser, cache cache.SetGetKey, cacheKey string) io.ReadCloser {
buf := []byte{}
+ if r == nil || cache == nil || cacheKey == "" {
+ log.Error().Msg("could not create CacheReader")
+ return r
+ }
return &writeCacheReader{
rc: r,
buff: bytes.NewBuffer(buf),
f: &f,
+ cache: cache,
cacheKey: cacheKey,
}
}