Skip to content

Commit f17ba2e

Browse files
fix(endpoint-media): correctly remove original file extension
1 parent c7c6246 commit f17ba2e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/endpoint-media/lib/file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const getFileProperties = async (publication, file, timeZone) => {
1919
const { ext } = await fileTypeFromBuffer(file.data);
2020
const published = getPublishedProperty(timeZone);
2121

22-
let basename = path.basename(file.name, ext);
22+
let basename = path.basename(file.name, path.extname(file.name));
2323
basename = slugify(basename, publication.slugSeparator);
2424

2525
return {

packages/endpoint-media/test/unit/file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("endpoint-media/lib/file", () => {
2323
};
2424
const file = {
2525
data: getFixture("file-types/photo.jpg", false),
26-
name: "Photo 1.jpg",
26+
name: "Photo 1.jpeg",
2727
md5: "be7d321488de26f2eb38834af7162164",
2828
};
2929
const result = await getFileProperties(publication, file, "UTC");

0 commit comments

Comments
 (0)