fixup! core: Allow writing data to storage after request is cancelled
This commit is contained in:
parent
2ea1fd43c8
commit
57be489b8b
|
@ -26,10 +26,6 @@ var (
|
||||||
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+\.]+$`)
|
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+\.]+$`)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
requestTimeoutDuration = 3 * time.Second
|
|
||||||
)
|
|
||||||
|
|
||||||
// HTTPError represents an error with an additional status code attached
|
// HTTPError represents an error with an additional status code attached
|
||||||
// which may be used when this error is sent in a HTTP response.
|
// which may be used when this error is sent in a HTTP response.
|
||||||
// See the net/http package for standardized status codes.
|
// See the net/http package for standardized status codes.
|
||||||
|
@ -418,8 +414,7 @@ func (handler *UnroutedHandler) PostFile(w http.ResponseWriter, r *http.Request)
|
||||||
|
|
||||||
// HeadFile returns the length and offset for the HEAD request
|
// HeadFile returns the length and offset for the HEAD request
|
||||||
func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request) {
|
func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), requestTimeoutDuration)
|
ctx := context.Background()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
id, err := extractIDFromPath(r.URL.Path)
|
id, err := extractIDFromPath(r.URL.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -819,8 +814,7 @@ func filterContentType(info FileInfo) (contentType string, contentDisposition st
|
||||||
|
|
||||||
// DelFile terminates an upload permanently.
|
// DelFile terminates an upload permanently.
|
||||||
func (handler *UnroutedHandler) DelFile(w http.ResponseWriter, r *http.Request) {
|
func (handler *UnroutedHandler) DelFile(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), requestTimeoutDuration)
|
ctx := context.Background()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
// Abort the request handling if the required interface is not implemented
|
// Abort the request handling if the required interface is not implemented
|
||||||
if !handler.composer.UsesTerminater {
|
if !handler.composer.UsesTerminater {
|
||||||
|
|
Loading…
Reference in New Issue