Skip to content

Commit 9a94456

Browse files
committed
feat
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent e68b2bc commit 9a94456

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/_helpers/mime.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {extname} from "path";
2222

2323
export type MimeType = string
2424

25-
const MAP_TEXT_EXTENSION_MIME: Readonly<Record<string, MimeType>> = {
26-
'': 'text/plain',
25+
const MAP_TEXT_EXTENSION_MIMETYPE: Readonly<Record<string, MimeType>> = {
26+
'': 'text/plain', // our scope is text!
2727
'.licence': 'text/plain',
2828
'.license': 'text/plain',
2929
'.md': 'text/markdown',
@@ -32,6 +32,6 @@ const MAP_TEXT_EXTENSION_MIME: Readonly<Record<string, MimeType>> = {
3232
'.xml': 'text/xml' // not `application/xml` -- our scope is text!
3333
} as const
3434

35-
export function getMimeForTextFile (filename: string): MimeType | undefined {
36-
return MAP_TEXT_EXTENSION_MIME[extname(filename).toLowerCase()]
35+
export function getMimeTypeForTextFile (filename: string): MimeType | undefined {
36+
return MAP_TEXT_EXTENSION_MIMETYPE[extname(filename).toLowerCase()]
3737
}

src/factories/fromPath.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
2323

2424
import {readFileSync} from "fs";
2525

26-
import {getMimeForTextFile, type MimeType} from "../_helpers/mime";
26+
import {getMimeTypeForTextFile, type MimeType} from "../_helpers/mime";
2727
import {AttachmentEncoding} from "../enums/attachmentEncoding";
2828
import {Attachment} from "../models/attachment";
2929

@@ -45,7 +45,7 @@ export class AttachmentFactory {
4545
}
4646

4747
public fromTextFile(file: string): Attachment | undefined {
48-
const contentType = getMimeForTextFile(file)
48+
const contentType = getMimeTypeForTextFile(file)
4949
if (contentType === undefined) {
5050
return undefined
5151
}

0 commit comments

Comments
 (0)