@@ -198,6 +198,7 @@ export class GitDiffView extends Disposable {
198198 private getHtmlForWebview ( diffContent : string ) : string {
199199 const nonce = getNonce ( ) ;
200200 this . logger . appendLine ( `handle ${ this . escapedStr } automatically` ) ;
201+ const encodedDiffContent = encodeURIComponent ( diffContent ) ;
201202 return /* html */ `
202203 <!DOCTYPE html>
203204 <html lang="en" id="diff-2-html">
@@ -226,7 +227,7 @@ export class GitDiffView extends Disposable {
226227 jQuery('#git-diff-body').on('click','.custom-git-btn',function(evt){
227228 _vscodeApi.postMessage(jQuery(this).data());
228229 });
229- const diffContent = \` ${ this . getEscapedDiffContent ( diffContent ) } \` ;
230+ const diffContent = decodeURIComponent(" ${ encodedDiffContent } ") ;
230231 const configuration = {
231232 drawFileList: true,
232233 fileListToggle: true,
@@ -276,11 +277,11 @@ export class GitDiffView extends Disposable {
276277 </html>` ;
277278 }
278279
279- private getEscapedDiffContent ( diff :string ) :string {
280- diff = diff . replace ( / [ \\ ` \$ ] / g, '\\$&' ) ;
281- diff = diff . replace ( / < / g, '${escapedStr}' ) ;
282- return diff ;
283- }
280+ // private getEscapedDiffContent(diff:string):string {
281+ // diff = diff.replace(/[\\`\$]/g, '\\$&');
282+ // diff = diff.replace(/</g, '${escapedStr}');
283+ // return diff;
284+ // }
284285 /* URI Manipulation Methods */
285286 private getMediaUri ( file : string ) {
286287 return this . panel . webview . asWebviewUri ( this . getUri ( 'media' , file ) ) ;
0 commit comments