mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Fix range header parsing
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -791,15 +791,12 @@ function handleRangeRequest({
|
||||
}
|
||||
|
||||
// Chromium only sends open-ended ranges: "start-"
|
||||
type Match = RegExpMatchArray & { 1: string };
|
||||
const match = range.match(/^bytes=(\d+)-$/);
|
||||
if (match == null) {
|
||||
if (match == null || match[1] == null) {
|
||||
log.error(`invalid range header: ${range}`);
|
||||
return create200Response();
|
||||
}
|
||||
|
||||
const [startInput] = match as Match;
|
||||
const startParam = safeParseInteger(startInput);
|
||||
const startParam = safeParseInteger(match[1]);
|
||||
if (startParam == null) {
|
||||
log.error(`invalid range header: ${range}`);
|
||||
return create200Response();
|
||||
|
||||
Reference in New Issue
Block a user