Skip to content

Commit 7d7c112

Browse files
committed
wip
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 8bbbdfe commit 7d7c112

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/_helpers/mime.node.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,37 @@ import { parse as parsePath } from 'node:path'
2121

2222
type MimeType = string
2323

24-
const MIME_TEXT_PLAIN: MimeType = 'text/plain'
24+
const MIMETYPE_TEXT_PLAIN: MimeType = 'text/plain'
2525

26-
const MAP_TEXT_EXTENSION_MIME: Readonly<Record<string, MimeType>> = {
27-
'': MIME_TEXT_PLAIN,
26+
const MAP_TEXT_EXTENSION_MIMETYPE: Readonly<Record<string, MimeType>> = {
27+
'': MIMETYPE_TEXT_PLAIN,
2828
// https://www.iana.org/assignments/media-types/media-types.xhtml
2929
'.csv': 'text/csv',
3030
'.htm': 'text/html',
3131
'.html': 'text/html',
3232
'.md': 'text/markdown',
33-
'.txt': MIME_TEXT_PLAIN,
33+
'.txt': MIMETYPE_TEXT_PLAIN,
3434
'.rst': 'text/prs.fallenstein.rst',
3535
'.xml': 'text/xml', // not `application/xml` -- our scope is text!
36+
// to be continued ... pullrequests welcome
3637
// add more mime types above this line. pull-requests welcome!
3738
// license-specific files
38-
'.license': MIME_TEXT_PLAIN,
39-
'.licence': MIME_TEXT_PLAIN
39+
'.license': MIMETYPE_TEXT_PLAIN,
40+
'.licence': MIMETYPE_TEXT_PLAIN,
4041
} as const
4142

4243
const LICENSE_FILENAME_BASE = new Set(['licence', 'license'])
4344
const LICENSE_FILENAME_EXT = new Set([
4445
'.apache',
4546
'.bsd',
4647
'.gpl',
47-
'.mit'
48+
'.mit',
49+
// to be continued ... pullrequests welcome
4850
])
4951

50-
export function getMimeForLicenseFile(filename: string): MimeType | undefined {
52+
export function getMimeTypeForLicenseFile(filename: string): MimeType | undefined {
5153
const {name, ext} = parsePath(filename.toLowerCase())
5254
return LICENSE_FILENAME_BASE.has(name) && LICENSE_FILENAME_EXT.has(ext)
53-
? MIME_TEXT_PLAIN
54-
: MAP_TEXT_EXTENSION_MIME[ext]
55+
? MIMETYPE_TEXT_PLAIN
56+
: MAP_TEXT_EXTENSION_MIMETYPE[ext]
5557
}

src/utils/licenseUtility.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
2020
import type NATIVE_FS from 'node:fs'
2121
import type NATIVE_PATH from "node:path";
2222

23-
import { getMimeForLicenseFile } from '../_helpers/mime.node'
23+
import { getMimeTypeForLicenseFile } from '../_helpers/mime.node'
2424
import { AttachmentEncoding } from '../enums/attachmentEncoding'
2525
import { Attachment } from '../models/attachment'
2626

@@ -79,7 +79,7 @@ export class LicenseEvidenceFetcher {
7979
// Don't follow symlinks for security reasons!
8080
continue
8181
}
82-
const contentType = getMimeForLicenseFile(file)
82+
const contentType = getMimeTypeForLicenseFile(file)
8383
if (contentType === undefined) {
8484
continue
8585
}

0 commit comments

Comments
 (0)