HTML file download in retool mobile app not working

I have developed a mobile app and as a function when the button is clicked, table data will retrieved and create an HTML file. I need to download this file and share it with others. I have tried many ways and this is the only working code that I'm having. However, in the mobile app (iOS) this file generates without the".html" extension and I have to manually include the same to view the HTML file data. How to fix this.???

===================
Code:

const data = query42.data;

// Check if data exists
if (!data || Object.keys(data).length === 0) {
console.error("No data found for the provided query.");
return;
}

// Transform columnar data to row-based data
const transformedData = ;
const numRows = data[Object.keys(data)[0]].length; // Number of rows (based on the length of the first column)

for (let i = 0; i < numRows; i++) {
const row = {};
for (const key in data) {
row[key] = data[key][i]; // Map each column to the corresponding value for this row
}
transformedData.push(row);
}

// Use the first row as the "record"
const record = transformedData[0];

// Generate HTML for the record
const htmlContent = `

Vehicle Inspection Report body { font-family: Arial, sans-serif; margin: 20px; } h1, h2 { color: #333; } .container { border: 1px solid #ccc; padding: 20px; border-radius: 8px; } .details, .engine-checklist { margin-top: 20px; } .details table, .engine-checklist table { width: 100%; border-collapse: collapse; } table th, table td { text-align: left; border: 1px solid #ddd; padding: 8px; } table th { background-color: #f4f4f4; } img { max-width: 100px; margin-top: 10px; }

Pre-Inspection Checklist

Vehicle Details

Vehicle Registration${record.vehicle_registration || "N/A"}
Make${record.vehicle_make || "N/A"}
Year${record.vehicle_year || "N/A"}
Mileage${record.current_mileage || "N/A"}
Checked By${record.checked_by || "N/A"}
Date${record.recorded_date || "N/A"}

Engine Checklist

Images

</div>
`;

// Encode the HTML content as Base64
const base64Content = btoa(unescape(encodeURIComponent(htmlContent)));

// Use Retool's utils.downloadFile() to trigger the download with proper extension and MIME type
utils.downloadFile(base64Content, "Vehicle_Report.html", "text/html");