aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-07-14 10:24:00 -0500
committerDhravya <[email protected]>2024-07-14 10:24:00 -0500
commitdff1bdd295ecfbb75b358ce3b1aee5c25cc0aa1c (patch)
tree51b5b43b658e98b56532804dab482e05fb723c80
parentpush changes (diff)
downloadsupermemory-dff1bdd295ecfbb75b358ce3b1aee5c25cc0aa1c.tar.xz
supermemory-dff1bdd295ecfbb75b358ce3b1aee5c25cc0aa1c.zip
quickfix: remove any instances of chunkings from raw tweets
-rw-r--r--packages/shared-types/utils.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/shared-types/utils.ts b/packages/shared-types/utils.ts
index 6816d99a..c97d053c 100644
--- a/packages/shared-types/utils.ts
+++ b/packages/shared-types/utils.ts
@@ -12,10 +12,15 @@ export const tweetToMd = (tweet: Tweet) => {
export const getRawTweet = (tweet: string) => {
// Get the content inside the last <raw> tag, there can any number of <raw> tags in the tweet (or just one)
- const rawTag = /<raw>(.*)<\/raw>/g;
+ const rawTag = /<raw>(.*)<\/raw>/gs; // Use 's' flag to match across multiple lines
const match = rawTag.exec(tweet);
- if (match) {
- return match[1];
+ if (match && match.length > 1) {
+ // Remove the specified item pattern
+ const cleanedContent = match[1]?.replace(
+ /<---chunkId:.*?\n.*?\n---->/gs,
+ "",
+ );
+ return cleanedContent;
}
return tweet;
};