From 50527c97d860f4caf3c021d23f64ea74e504fa33 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 30 May 2023 12:54:18 -0700 Subject: [PATCH] Use desired file name when generating new md pasted file paths (#183861) Fixes #183851 --- .../src/languageFeatures/copyFiles/copyFiles.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/markdown-language-features/src/languageFeatures/copyFiles/copyFiles.ts b/extensions/markdown-language-features/src/languageFeatures/copyFiles/copyFiles.ts index 280aa541e15..0c7eb8c5727 100644 --- a/extensions/markdown-language-features/src/languageFeatures/copyFiles/copyFiles.ts +++ b/extensions/markdown-language-features/src/languageFeatures/copyFiles/copyFiles.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as path from 'path'; import * as picomatch from 'picomatch'; import * as vscode from 'vscode'; import { Utils } from 'vscode-uri'; @@ -43,8 +42,9 @@ export class NewFilePathGenerator { const desiredPath = getDesiredNewFilePath(config, document, file); const root = Utils.dirname(desiredPath); - const ext = path.extname(file.name); - const baseName = path.basename(file.name, ext); + const ext = Utils.extname(desiredPath); + let baseName = Utils.basename(desiredPath); + baseName = baseName.slice(0, baseName.length - ext.length); for (let i = 0; ; ++i) { if (token.isCancellationRequested) { return undefined;