summaryrefslogtreecommitdiff
path: root/internal/api/fileserver/servefile.go
diff options
context:
space:
mode:
authorLibravatar Jadeiin <92222981+Jadeiin@users.noreply.github.com>2023-11-29 10:25:52 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-29 11:25:52 +0100
commit2cc264584e807297e26f6447eeaf2ad5c30dc10a (patch)
tree9e0b760eb35965a126086d0838f4a3693ce229e1 /internal/api/fileserver/servefile.go
parent[chore]: Bump github.com/gorilla/websocket from 1.5.0 to 1.5.1 (#2335) (diff)
downloadgotosocial-2cc264584e807297e26f6447eeaf2ad5c30dc10a.tar.xz
[bugfix] Correctly handle range > content-length (#2395)
Diffstat (limited to 'internal/api/fileserver/servefile.go')
-rw-r--r--internal/api/fileserver/servefile.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/api/fileserver/servefile.go b/internal/api/fileserver/servefile.go
index 5fe79f1d7..8fb5a838e 100644
--- a/internal/api/fileserver/servefile.go
+++ b/internal/api/fileserver/servefile.go
@@ -206,10 +206,11 @@ func serveFileRange(rw http.ResponseWriter, r *http.Request, src io.Reader, rng
return
}
- if end > size {
+ if end >= size {
// According to the http spec if end >= size the server should return the rest of the file
// https://www.rfc-editor.org/rfc/rfc9110#section-14.1.2-6
end = size - 1
+ endRng = strconv.FormatInt(end, 10)
}
} else {
// No end supplied, implying file end