diff --git a/admin/app/services/map_service.ts b/admin/app/services/map_service.ts index c1157b0..0e1c902 100644 --- a/admin/app/services/map_service.ts +++ b/admin/app/services/map_service.ts @@ -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) { diff --git a/admin/app/utils/downloads.ts b/admin/app/utils/downloads.ts index 23988da..bfe189a 100644 --- a/admin/app/utils/downloads.ts +++ b/admin/app/utils/downloads.ts @@ -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