[bugfix] fix file range length calculation being off by 1 (#1448)
* small formatting change * fix range handling new length calculation --------- Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
6a6647d68b
commit
ac2bdbbc62
|
@ -218,8 +218,9 @@ func serveFileRange(rw http.ResponseWriter, src io.Reader, rng string, size int6
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine content len
|
// Determine new content length
|
||||||
length := end - start
|
// after slicing to given range.
|
||||||
|
length := end - start + 1
|
||||||
|
|
||||||
if end < size-1 {
|
if end < size-1 {
|
||||||
// Range end < file end, limit the reader
|
// Range end < file end, limit the reader
|
||||||
|
|
|
@ -39,11 +39,9 @@ func (p *processor) Delete(ctx context.Context, mediaAttachmentID string) gtserr
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the attachment
|
// delete the attachment
|
||||||
if err := p.db.DeleteByID(ctx, mediaAttachmentID, attachment); err != nil {
|
if err := p.db.DeleteByID(ctx, mediaAttachmentID, attachment); err != nil && !errors.Is(err, db.ErrNoEntries) {
|
||||||
if err != db.ErrNoEntries {
|
|
||||||
errs = append(errs, fmt.Sprintf("remove attachment: %s", err))
|
errs = append(errs, fmt.Sprintf("remove attachment: %s", err))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(errs) != 0 {
|
if len(errs) != 0 {
|
||||||
return gtserror.NewErrorInternalError(fmt.Errorf("Delete: one or more errors removing attachment with id %s: %s", mediaAttachmentID, strings.Join(errs, "; ")))
|
return gtserror.NewErrorInternalError(fmt.Errorf("Delete: one or more errors removing attachment with id %s: %s", mediaAttachmentID, strings.Join(errs, "; ")))
|
||||||
|
|
Loading…
Reference in New Issue