From 16084322ca2fbceeb6b155756ba8d9259c428861 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:00:08 -0800 Subject: [PATCH] chore(deps-dev): bump @types/node from 20.14.2 to 20.17.14 (#8261) * chore(deps-dev): bump @types/node from 20.14.2 to 20.17.14 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.14.2 to 20.17.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * tsc * tsc --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moor --- package.json | 2 +- server/utils/DocumentConverter.ts | 14 +++++++------- yarn.lock | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index f31d84dd98..7c022b05bd 100644 --- a/package.json +++ b/package.json @@ -289,7 +289,7 @@ "@types/markdown-it-emoji": "^2.0.4", "@types/mime-types": "^2.1.4", "@types/natural-sort": "^0.0.24", - "@types/node": "20.14.2", + "@types/node": "20.17.14", "@types/node-fetch": "^2.6.9", "@types/nodemailer": "^6.4.17", "@types/passport-oauth2": "^1.4.17", diff --git a/server/utils/DocumentConverter.ts b/server/utils/DocumentConverter.ts index cbe5d21f46..a5e8741342 100644 --- a/server/utils/DocumentConverter.ts +++ b/server/utils/DocumentConverter.ts @@ -67,7 +67,7 @@ export class DocumentConverter { } public static async htmlToMarkdown(content: Buffer | string) { - if (content instanceof Buffer) { + if (typeof content !== "string") { content = content.toString("utf8"); } @@ -117,26 +117,26 @@ export class DocumentConverter { } public static fileToMarkdown(content: Buffer | string) { - if (content instanceof Buffer) { + if (typeof content !== "string") { content = content.toString("utf8"); } return content; } - public static async confluenceToMarkdown(value: Buffer | string) { - if (value instanceof Buffer) { - value = value.toString("utf8"); + public static async confluenceToMarkdown(content: Buffer | string) { + if (typeof content !== "string") { + content = content.toString("utf8"); } // We're only supporting the output from Confluence here, regular Word documents should call // into the docxToMarkdown importer. See: https://jira.atlassian.com/browse/CONFSERVER-38237 - if (!value.includes("Content-Type: multipart/related")) { + if (!content.includes("Content-Type: multipart/related")) { throw FileImportError("Unsupported Word file"); } // Confluence "Word" documents are actually just multi-part email messages, so we can use // mailparser to parse the content. - const parsed = await simpleParser(value); + const parsed = await simpleParser(content); if (!parsed.html) { throw FileImportError("Unsupported Word file (No content found)"); } diff --git a/yarn.lock b/yarn.lock index 23522aaee4..e45bd564fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5040,12 +5040,12 @@ "@types/node" "*" form-data "^4.0.0" -"@types/node@*", "@types/node@20.14.2", "@types/node@>=10.0.0", "@types/node@>=13.7.0": - version "20.14.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18" - integrity sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q== +"@types/node@*", "@types/node@20.17.14", "@types/node@>=10.0.0", "@types/node@>=13.7.0": + version "20.17.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.14.tgz#579e7d75eeb5d46b75c73c98821639e64b689608" + integrity sha512-w6qdYetNL5KRBiSClK/KWai+2IMEJuAj+EujKCumalFOwXtvOXaEan9AuwcRID2IcOIAWSIfR495hBtgKlx2zg== dependencies: - undici-types "~5.26.4" + undici-types "~6.19.2" "@types/nodemailer@^6.4.17": version "6.4.17" @@ -15225,10 +15225,10 @@ underscore@^1.13.1: resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" integrity "sha1-DBxr0t9UtrafIxQGbWW2zeb8+dE= sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity "sha1-vNU5iT0AtW6WT9JlekhmsiGmVhc= sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0"