fix: minor type guarding fixes after axios bump

This commit is contained in:
jakeaturner 2026-06-07 21:18:42 +00:00
parent 555ffa8790
commit b2bea191a8
No known key found for this signature in database
GPG Key ID: B1072EBDEECE328D
2 changed files with 3 additions and 3 deletions

View File

@ -301,7 +301,7 @@ export class MapService implements IMapService {
}
const contentLength = response.headers['content-length']
const size = contentLength ? parseInt(contentLength, 10) : 0
const size = contentLength ? parseInt(contentLength.toString(), 10) : 0
return { filename, size }
} catch (error: any) {

View File

@ -54,8 +54,8 @@ export async function doResumableDownload({
// Without this default, the validator below throws `MIME type is not allowed`
// and breaks all downloads from kiwix's primary host (#848).
const contentType =
headResponse.headers['content-type'] || 'application/octet-stream'
const totalBytes = parseInt(headResponse.headers['content-length'] || '0')
headResponse.headers['content-type']?.toString() || 'application/octet-stream'
const totalBytes = parseInt(headResponse.headers['content-length']?.toString() || '0', 10)
const supportsRangeRequests = headResponse.headers['accept-ranges'] === 'bytes'
// If allowedMimeTypes is provided, check content type