mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 17:24:01 -05:00
Fix/open relative on dev (#8359)
* escape characters only on hyperlinks * removed extra line * added tests and changes to accomodate tests * updates to test * added comments * use path.join * format doc build error * added comments
This commit is contained in:
@@ -59,7 +59,7 @@ export class NotebookMarkdownRenderer {
|
||||
let signalInnerHTML: () => void;
|
||||
const withInnerHTML = new Promise(c => signalInnerHTML = c);
|
||||
|
||||
let notebookFolder = path.dirname(this._notebookURI.fsPath) + '/';
|
||||
let notebookFolder = this._notebookURI ? path.join(path.dirname(this._notebookURI.fsPath), path.sep) : '';
|
||||
if (!this._baseUrls.some(x => x === notebookFolder)) {
|
||||
this._baseUrls.push(notebookFolder);
|
||||
}
|
||||
@@ -111,7 +111,12 @@ export class NotebookMarkdownRenderer {
|
||||
text = removeMarkdownEscapes(text);
|
||||
}
|
||||
title = removeMarkdownEscapes(title);
|
||||
href = removeMarkdownEscapes(href);
|
||||
// only remove markdown escapes if it's a hyperlink, filepath usually can start with .{}_
|
||||
// and the below function escapes them if it encounters in the path.
|
||||
// dev note: using path.isAbsolute instead of isPathLocal since the latter accepts resolver (IRenderMime.IResolver) to check isLocal
|
||||
if (!path.isAbsolute(href)) {
|
||||
href = removeMarkdownEscapes(href);
|
||||
}
|
||||
if (
|
||||
!href
|
||||
|| !markdown.isTrusted
|
||||
@@ -203,7 +208,7 @@ export class NotebookMarkdownRenderer {
|
||||
href = this.resolveUrl(base, href);
|
||||
}
|
||||
try {
|
||||
href = encodeURI(href).replace(/%5C/g, '\\').replace(/%25/g, '%');
|
||||
href = encodeURI(href).replace(/%5C/g, '\\').replace(/%7C/g, '|').replace(/%25/g, '%');
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user