- #322: Fullscreen overlay padding and main-view scrollable so volume stays above taskbar when Up next is shown - #313: Settings tab content constrained on small displays with max-width, min-width, overflow-x - #278: HEAD request before GET for download to get Content-Length for progress bar; resolveDownloadTotalBytes in downloadProgressUtils.js
14 lines
576 B
JavaScript
14 lines
576 B
JavaScript
/**
|
|
* Helpers for download progress. Extracted for testability (fixes #278).
|
|
* Resolve total byte count from GET and optional HEAD Content-Length.
|
|
*/
|
|
|
|
/**
|
|
* @param {string | null} contentLengthFromGet - Content-Length header from GET response
|
|
* @param {number | null} headContentLength - Content-Length from prior HEAD request
|
|
* @returns {number}
|
|
*/
|
|
export function resolveDownloadTotalBytes(contentLengthFromGet, headContentLength) {
|
|
const fromGet = contentLengthFromGet ? parseInt(contentLengthFromGet, 10) : null;
|
|
return fromGet ?? headContentLength ?? 0;
|
|
}
|