From 24958d2d8d336c9fed1b64e0d0f423edac1a2a1e Mon Sep 17 00:00:00 2001 From: corentin Date: Fri, 12 Aug 2022 16:21:52 +0200 Subject: [PATCH] Fix magic mime when `file` output is multiline --- app/exec/extension/_lib/vsix-manifest-builder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/exec/extension/_lib/vsix-manifest-builder.ts b/app/exec/extension/_lib/vsix-manifest-builder.ts index a432398f..569b0352 100644 --- a/app/exec/extension/_lib/vsix-manifest-builder.ts +++ b/app/exec/extension/_lib/vsix-manifest-builder.ts @@ -728,7 +728,8 @@ export class VsixManifestBuilder extends ManifestBuilder { } } else { if (typeof stdout === "string") { - let magicMime = _.trimEnd(stdout.substr(stdout.lastIndexOf(" ") + 1), "\n"); + const firstLine = stdout.split("\n")[0] + const magicMime = firstLine.substring(firstLine.lastIndexOf(" ") + 1); trace.debug("Magic mime type for %s is %s.", fileName, magicMime); if (magicMime) { if (extension) {