From b2bea191a85b166fc8f9fc7655d160e185af8a09 Mon Sep 17 00:00:00 2001 From: jakeaturner Date: Sun, 7 Jun 2026 21:18:42 +0000 Subject: [PATCH] fix: minor type guarding fixes after axios bump --- admin/app/services/map_service.ts | 2 +- admin/app/utils/downloads.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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