diff --git a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx index 2cb97396a2..07b1485eef 100644 --- a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx +++ b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx @@ -226,6 +226,28 @@ test("Patch request is not send when there are no changes", async () => { expect(patchTemplateVersion).toBeCalledTimes(0); }); +test("The file is uploaded with the correct content type", async () => { + const user = userEvent.setup(); + renderTemplateEditorPage(); + const topbar = await screen.findByTestId("topbar"); + + const newTemplateVersion = { + ...MockTemplateVersion, + id: "new-version-id", + name: "new-version", + }; + + await typeOnEditor("new content", user); + await buildTemplateVersion(newTemplateVersion, user, topbar); + + expect(API.uploadFile).toHaveBeenCalledWith( + expect.objectContaining({ + name: "template.tar", + type: "application/x-tar", + }), + ); +}); + describe.each([ { testName: "Do not ask when template version has no errors", diff --git a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.tsx b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.tsx index cf74c0b099..b3090eb6d3 100644 --- a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.tsx +++ b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.tsx @@ -329,7 +329,7 @@ const generateVersionFiles = async ( tar.addFolder(fullPath, baseFileInfo); }); const blob = (await tar.write()) as Blob; - return new File([blob], "template.tar"); + return new File([blob], "template.tar", { type: "application/x-tar" }); }; const publishVersion = async (options: {