preview: accept context parameter
This commit is contained in:
parent
01ff8f69aa
commit
15c02efe96
@ -161,7 +161,7 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
this.handleInformation(w, r.URL.Path[len(metadataUrlPrefix):])
|
this.handleInformation(w, r.URL.Path[len(metadataUrlPrefix):])
|
||||||
|
|
||||||
} else if r.Method == "GET" && strings.HasPrefix(r.URL.Path, previewUrlPrefix) {
|
} 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) {
|
} else if r.Method == "GET" && rxThumbUrl.MatchString(r.URL.Path) {
|
||||||
parts := rxThumbUrl.FindStringSubmatch(r.URL.Path)
|
parts := rxThumbUrl.FindStringSubmatch(r.URL.Path)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package contented
|
package contented
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
"time"
|
"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, `-`)
|
fileIDs := strings.Split(fileIDList, `-`)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user