Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

fix(social-publish): make alt parsing linear

Barack Sokulluc0f47a77af9a
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index ef7ef5203..b6c6888d4 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -25554,7 +25554,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const quotedPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:β€œ([\\s\\S]+?)”|γ€Œ([\\s\\S]+?)」|γ€Ž([\\s\\S]+?)』|Β«([\\s\\S]+?)Β»|"([\\s\\S]+?)")`, 'iu');
const singleQuotePattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:(?<!\\p{L})'([\\s\\S]+?)'(?!\\p{L}))`, 'iu');
const colonPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?<!https?|ftp|sftp)(?:(?<!\\d)[::]|[::](?!\\d{2}))(?!\\/\\/)\\s*([\\s\\S]+)$`, 'iu');
- const altTextMetadataPattern = /(?<![\p{L}\p{N}_])(?:attachment\s+)?(?:alt(?:ernative)?\s+text|image\s+alt\s+text|media\s+alt\s+text)\s*(?::|=)?\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|β€œ[\s\S]*?”|Β«[\s\S]*?Β»|γ€Œ[\s\S]*?」|γ€Ž[\s\S]*?』)/giu;
+ const altTextMetadataPattern = /(?<![\p{L}\p{N}_])(?:attachment\s+)?(?:alt(?:ernative)?\s+text|image\s+alt\s+text|media\s+alt\s+text)\s*(?::|=)?\s*(?:"(?:\\[^"\\]|[^"\\])*"|'(?:\\[^'\\]|[^'\\])*'|β€œ[^”]*”|Β«[^Β»]*Β»|γ€Œ[^」]*」|γ€Ž[^』]*』)/giu;
for (const candidateText of candidates) {
// A quoted alt-text value describes an attachment; it is not the post
// body merely because it follows the publish verb.
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index c0e061658..e72c891a0 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -23161,7 +23161,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const quotedPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:β€œ([\\s\\S]+?)”|γ€Œ([\\s\\S]+?)」|γ€Ž([\\s\\S]+?)』|Β«([\\s\\S]+?)Β»|"([\\s\\S]+?)")`, 'iu');
const singleQuotePattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:(?<!\\p{L})'([\\s\\S]+?)'(?!\\p{L}))`, 'iu');
const colonPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?<!https?|ftp|sftp)(?:(?<!\\d)[::]|[::](?!\\d{2}))(?!\\/\\/)\\s*([\\s\\S]+)$`, 'iu');
- const altTextMetadataPattern = /(?<![\p{L}\p{N}_])(?:attachment\s+)?(?:alt(?:ernative)?\s+text|image\s+alt\s+text|media\s+alt\s+text)\s*(?::|=)?\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|β€œ[\s\S]*?”|Β«[\s\S]*?Β»|γ€Œ[\s\S]*?」|γ€Ž[\s\S]*?』)/giu;
+ const altTextMetadataPattern = /(?<![\p{L}\p{N}_])(?:attachment\s+)?(?:alt(?:ernative)?\s+text|image\s+alt\s+text|media\s+alt\s+text)\s*(?::|=)?\s*(?:"(?:\\[^"\\]|[^"\\])*"|'(?:\\[^'\\]|[^'\\])*'|β€œ[^”]*”|Β«[^Β»]*Β»|γ€Œ[^」]*」|γ€Ž[^』]*』)/giu;
for (const candidateText of candidates) {
// A quoted alt-text value describes an attachment; it is not the post
// body merely because it follows the publish verb.