kv-music/js/downloadProgressUtils.js
Srihari NT 677f515e4d fix(ui): fullscreen volume above taskbar, settings overflow, download progress
- #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
2026-03-15 15:41:32 +05:30

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;
}