Update the upload length in FileInfo when it's sent
This commit is contained in:
parent
c94e0cd0b6
commit
64c02a9de1
|
@ -456,6 +456,17 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if info.SizeIsDeferred && r.Header.Get("Upload-Length") != "" {
|
||||||
|
uploadLength, err := strconv.ParseInt(r.Header.Get("Upload-Length"), 10, 64)
|
||||||
|
if err != nil || uploadLength < 0 {
|
||||||
|
handler.sendError(w, r, ErrInvalidOffset)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
info.Size = uploadLength
|
||||||
|
info.SizeIsDeferred = false
|
||||||
|
}
|
||||||
|
|
||||||
if err := handler.writeChunk(id, info, w, r); err != nil {
|
if err := handler.writeChunk(id, info, w, r); err != nil {
|
||||||
handler.sendError(w, r, err)
|
handler.sendError(w, r, err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue