Skip to content

Commit

Permalink
Merge branch 'main' into feature/identity_deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 19, 2024
2 parents a377061 + e425dbb commit e92b6c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/coreHttpApi/controllers/FilesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class FilesController extends BaseController {
const result = await this.transportServices.files.uploadOwnFile({
content: file?.buffer,
expiresAt,
filename: file?.originalname,
filename: file?.originalname !== undefined ? Buffer.from(file.originalname, "latin1").toString("utf8") : undefined,
mimetype: file?.mimetype,
title,
description
Expand Down
20 changes: 20 additions & 0 deletions test/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ describe("File Upload", () => {
file = response.result;
});

test("can upload file with umlaut in title and filename", async () => {
const response = await client1.files.uploadOwnFile(await makeUploadRequest({ title: "ÄÖÜ", filename: "ÄÖÜ.txt" }));

expect(response).toBeSuccessful(ValidationSchema.File);

const file = response.result;
expect(file.title).toBe("ÄÖÜ");
expect(file.filename).toBe("ÄÖÜ.txt");
});

test("can upload file with space in title and filename", async () => {
const response = await client1.files.uploadOwnFile(await makeUploadRequest({ title: "a file", filename: "a file.txt" }));

expect(response).toBeSuccessful(ValidationSchema.File);

const file = response.result;
expect(file.title).toBe("a file");
expect(file.filename).toBe("a file.txt");
});

test("can upload file without description", async () => {
const response = await client1.files.uploadOwnFile({
title: "File Title",
Expand Down

0 comments on commit e92b6c9

Please sign in to comment.