diff --git a/Server.go b/Server.go index c367854..762eda3 100644 --- a/Server.go +++ b/Server.go @@ -161,7 +161,7 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { this.handleInformation(w, r.URL.Path[len(metadataUrlPrefix):]) } else if r.Method == "GET" && strings.HasPrefix(r.URL.Path, previewUrlPrefix) { - this.handlePreview(w, r.URL.Path[len(previewUrlPrefix):]) + this.handlePreview(r.Context(), w, r.URL.Path[len(previewUrlPrefix):]) } else if r.Method == "GET" && rxThumbUrl.MatchString(r.URL.Path) { parts := rxThumbUrl.FindStringSubmatch(r.URL.Path) diff --git a/preview.go b/preview.go index 7cad364..4de5862 100644 --- a/preview.go +++ b/preview.go @@ -1,6 +1,7 @@ package contented import ( + "context" "encoding/json" "fmt" "html" @@ -12,7 +13,7 @@ import ( "time" ) -func (this *Server) handlePreview(w http.ResponseWriter, fileIDList string) { +func (this *Server) handlePreview(ctx context.Context, w http.ResponseWriter, fileIDList string) { fileIDs := strings.Split(fileIDList, `-`)