nomagick commited on
Commit
2e025d1
·
unverified ·
1 Parent(s): fef1d0f

fix: the complex regexp caused node.js process to hang

Browse files
backend/functions/src/index.ts CHANGED
@@ -27,7 +27,3 @@ process.on('uncaughtException', (err) => {
27
  console.error('Uncaught exception, process quit.');
28
  throw err;
29
  });
30
-
31
- if (!process.env.FUNCTIONS_EMULATOR) {
32
- registry.walk_around_firebase_stall = true;
33
- }
 
27
  console.error('Uncaught exception, process quit.');
28
  throw err;
29
  });
 
 
 
 
backend/functions/src/utils/markdown.ts CHANGED
@@ -2,14 +2,14 @@
2
  export function tidyMarkdown(markdown: string): string {
3
 
4
  // Step 1: Handle complex broken links with text and optional images spread across multiple lines
5
- let normalizedMarkdown = markdown.replace(/\[\s*([^]+?)\s*\]\s*\(\s*([^)]+)\s*\)/g, (match, text, url) => {
6
  // Remove internal new lines and excessive spaces within the text
7
  text = text.replace(/\s+/g, ' ').trim();
8
  url = url.replace(/\s+/g, '').trim();
9
  return `[${text}](${url})`;
10
  });
11
 
12
- normalizedMarkdown = normalizedMarkdown.replace(/\[\s*([^!]*?)\s*\n*(?:!\[([^\]]*)\]\((.*?)\))?\s*\n*\]\s*\(\s*([^)]+)\s*\)/g, (match, text, alt, imgUrl, linkUrl) => {
13
  // Normalize by removing excessive spaces and new lines
14
  text = text.replace(/\s+/g, ' ').trim();
15
  alt = alt ? alt.replace(/\s+/g, ' ').trim() : '';
 
2
  export function tidyMarkdown(markdown: string): string {
3
 
4
  // Step 1: Handle complex broken links with text and optional images spread across multiple lines
5
+ let normalizedMarkdown = markdown.replace(/\[\s*([^\]\n]+?)\s*\]\s*\(\s*([^)]+)\s*\)/g, (match, text, url) => {
6
  // Remove internal new lines and excessive spaces within the text
7
  text = text.replace(/\s+/g, ' ').trim();
8
  url = url.replace(/\s+/g, '').trim();
9
  return `[${text}](${url})`;
10
  });
11
 
12
+ normalizedMarkdown = normalizedMarkdown.replace(/\[\s*([^\]\n!]*?)\s*\n*(?:!\[([^\]]*)\]\((.*?)\))?\s*\n*\]\s*\(\s*([^)]+)\s*\)/g, (match, text, alt, imgUrl, linkUrl) => {
13
  // Normalize by removing excessive spaces and new lines
14
  text = text.replace(/\s+/g, ' ').trim();
15
  alt = alt ? alt.replace(/\s+/g, ' ').trim() : '';
thinapps-shared CHANGED
@@ -1 +1 @@
1
- Subproject commit 21e6ece0f378fe26db888bc5ff7715a43bf022bd
 
1
+ Subproject commit d3bb3a7335ec9d96c68d1edf1b66fdf5e2fe5b7c