Fix quoted link failures by removing quotes from unescaped paths, rather than just the escaped paths. (#17419)

This commit is contained in:
Cory Rivera
2021-10-20 18:12:39 -07:00
committed by GitHub
parent 6fb66e5de6
commit 0bc8e54568
3 changed files with 26 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ export function unquoteText(quotedText: string): string {
let doubleQuotesRegex = /^[\"\'](.*)[\"\']$/;
let matches = doubleQuotesRegex.exec(quotedText);
if (matches && matches[1]) {
quotedText = matches[1];
return matches[1];
}
return quotedText;
}

View File

@@ -158,7 +158,8 @@ export class LinkCalloutDialog extends Modal {
public insert(): void {
this.hide('ok');
let escapedLabel = escapeLabel(this._linkTextInputBox.value);
let escapedUrl = escapeUrl(unquoteText(this._linkUrlInputBox.value));
let unquotedUrl = unquoteText(this._linkUrlInputBox.value);
let escapedUrl = escapeUrl(unquotedUrl);
if (this._previouslySelectedRange) {
// Reset selection to previous state before callout was open
@@ -169,7 +170,7 @@ export class LinkCalloutDialog extends Modal {
this._selectionComplete.resolve({
insertEscapedMarkdown: `[${escapedLabel}](${escapedUrl})`,
insertUnescapedLinkLabel: this._linkTextInputBox.value,
insertUnescapedLinkUrl: this._linkUrlInputBox.value
insertUnescapedLinkUrl: unquotedUrl
});
}
}