Correct parsing Upload-Concat for final uplaods
Addresses https://github.com/tus/tus-resumable-upload-protocol/issues/123
This commit is contained in:
parent
b05382eced
commit
7710fd79fb
|
@ -118,6 +118,9 @@ func TestConcat(t *testing.T) {
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
ReqHeader: map[string]string{
|
ReqHeader: map[string]string{
|
||||||
"Tus-Resumable": "1.0.0",
|
"Tus-Resumable": "1.0.0",
|
||||||
|
// A space between `final;` and the first URL should be allowed due to
|
||||||
|
// compatibility reasons, even if the specification does not define
|
||||||
|
// it. Therefore this character is included in this test case.
|
||||||
"Upload-Concat": "final; http://tus.io/files/a /files/b/",
|
"Upload-Concat": "final; http://tus.io/files/a /files/b/",
|
||||||
},
|
},
|
||||||
Code: http.StatusCreated,
|
Code: http.StatusCreated,
|
||||||
|
|
|
@ -341,8 +341,11 @@ func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request)
|
||||||
if info.IsFinal {
|
if info.IsFinal {
|
||||||
v := "final;"
|
v := "final;"
|
||||||
for _, uploadID := range info.PartialUploads {
|
for _, uploadID := range info.PartialUploads {
|
||||||
v += " " + handler.absFileURL(r, uploadID)
|
v += handler.absFileURL(r, uploadID) + " "
|
||||||
}
|
}
|
||||||
|
// Remove trailing space
|
||||||
|
v = v[:len(v)-1]
|
||||||
|
|
||||||
w.Header().Set("Upload-Concat", v)
|
w.Header().Set("Upload-Concat", v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue