fix: minor type guarding fixes after axios bump
This commit is contained in:
parent
555ffa8790
commit
b2bea191a8
|
|
@ -301,7 +301,7 @@ export class MapService implements IMapService {
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentLength = response.headers['content-length']
|
const contentLength = response.headers['content-length']
|
||||||
const size = contentLength ? parseInt(contentLength, 10) : 0
|
const size = contentLength ? parseInt(contentLength.toString(), 10) : 0
|
||||||
|
|
||||||
return { filename, size }
|
return { filename, size }
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ export async function doResumableDownload({
|
||||||
// Without this default, the validator below throws `MIME type is not allowed`
|
// Without this default, the validator below throws `MIME type is not allowed`
|
||||||
// and breaks all downloads from kiwix's primary host (#848).
|
// and breaks all downloads from kiwix's primary host (#848).
|
||||||
const contentType =
|
const contentType =
|
||||||
headResponse.headers['content-type'] || 'application/octet-stream'
|
headResponse.headers['content-type']?.toString() || 'application/octet-stream'
|
||||||
const totalBytes = parseInt(headResponse.headers['content-length'] || '0')
|
const totalBytes = parseInt(headResponse.headers['content-length']?.toString() || '0', 10)
|
||||||
const supportsRangeRequests = headResponse.headers['accept-ranges'] === 'bytes'
|
const supportsRangeRequests = headResponse.headers['accept-ranges'] === 'bytes'
|
||||||
|
|
||||||
// If allowedMimeTypes is provided, check content type
|
// If allowedMimeTypes is provided, check content type
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue