Skip to content

Commit

Permalink
chore: add link to SO post
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Apr 19, 2024
1 parent e11ff13 commit de8fa96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/item/fileItem/fileItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const buildS3FileExtra = (
});

/**
*
* Extract extension from filename.
* @param fileName Name of the file to get the extension from
* @param options Options object, currently contains `includeDot` to return the extension with a leading dot, for easy concatenation, this option is true by default
* @returns
Expand All @@ -62,6 +62,7 @@ export const getFileExtension = (
fileName: string,
{ includeDot = true } = {},
): string | undefined => {
// this code has been adapted from https://stackoverflow.com/a/680982
const extensionRegex = /(?:\.([^.]+))?$/;
const extension = extensionRegex.exec(fileName)?.[1];
if (extension) {
Expand Down

0 comments on commit de8fa96

Please sign in to comment.