Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb948798

Browse files
ethanndicksonstirby
authored andcommitted
fix: set content type when uploading edited template (#15440)
Fixes a bug where a file produced by `generateVersionFiles` (as usedwhen uploading a web UI edited template) produced a file where the`type` field was unset.This meant the change in#15410 used the unset type value as the contentheader when uploading, causing it to always fail.(cherry picked from commitd2e4969)
1 parent2fb46f4 commitb948798

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

‎site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,28 @@ test("Patch request is not send when there are no changes", async () => {
226226
expect(patchTemplateVersion).toBeCalledTimes(0);
227227
});
228228

229+
test("The file is uploaded with the correct content type",async()=>{
230+
constuser=userEvent.setup();
231+
renderTemplateEditorPage();
232+
consttopbar=awaitscreen.findByTestId("topbar");
233+
234+
constnewTemplateVersion={
235+
...MockTemplateVersion,
236+
id:"new-version-id",
237+
name:"new-version",
238+
};
239+
240+
awaittypeOnEditor("new content",user);
241+
awaitbuildTemplateVersion(newTemplateVersion,user,topbar);
242+
243+
expect(API.uploadFile).toHaveBeenCalledWith(
244+
expect.objectContaining({
245+
name:"template.tar",
246+
type:"application/x-tar",
247+
}),
248+
);
249+
});
250+
229251
describe.each([
230252
{
231253
testName:"Do not ask when template version has no errors",

‎site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ const generateVersionFiles = async (
329329
tar.addFolder(fullPath,baseFileInfo);
330330
});
331331
constblob=(awaittar.write())asBlob;
332-
returnnewFile([blob],"template.tar");
332+
returnnewFile([blob],"template.tar",{type:"application/x-tar"});
333333
};
334334

335335
constpublishVersion=async(options:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp