Kaynağa Gözat

fix #226 xss escapes inline codeblocks

Yuki Takei 8 yıl önce
ebeveyn
işleme
b470299a36

+ 2 - 2
resource/js/util/interceptor/detach-code-blocks.js

@@ -40,8 +40,8 @@ export class DetachCodeBlockInterceptor extends BasicInterceptor {
 
 
     context.dcbContextMap = {};
     context.dcbContextMap = {};
 
 
-    // see: https://regex101.com/r/8PAEcC/1
-    context.markdown = markdown.replace(/```(.|[\r\n])*?```/gm, (all) => {
+    // see: https://regex101.com/r/8PAEcC/2
+    context.markdown = markdown.replace(/(```(.|[\r\n])*?```)|(`[^\r\n]*?`)/gm, (all) => {
       // create ID
       // create ID
       const replaceId = 'dcb-' + this.createRandomStr(8);
       const replaceId = 'dcb-' + this.createRandomStr(8);