fix admin axios header typecheck
This commit is contained in:
parent
97e17b8664
commit
513f1345ca
|
|
@ -300,7 +300,7 @@ export class MapService implements IMapService {
|
|||
throw new Error(`Failed to fetch file info: ${response.status} ${response.statusText}`)
|
||||
}
|
||||
|
||||
const contentLength = response.headers['content-length']
|
||||
const contentLength = String(response.headers['content-length'] ?? '')
|
||||
const size = contentLength ? parseInt(contentLength, 10) : 0
|
||||
|
||||
return { filename, size }
|
||||
|
|
|
|||
|
|
@ -53,9 +53,8 @@ export async function doResumableDownload({
|
|||
// already in every binary-content allowlist we use (ZIM, PMTILES, base assets).
|
||||
// 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')
|
||||
const contentType = String(headResponse.headers['content-type'] ?? 'application/octet-stream')
|
||||
const totalBytes = parseInt(String(headResponse.headers['content-length'] ?? '0'))
|
||||
const supportsRangeRequests = headResponse.headers['accept-ranges'] === 'bytes'
|
||||
|
||||
// If allowedMimeTypes is provided, check content type
|
||||
|
|
|
|||
Loading…
Reference in New Issue