-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix regex for parsing linkedin array links #2274
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The second replace was incorrect, resulting in a link like `https://google.com]` which failed zod validation
📝 WalkthroughWalkthroughA regular expression in the Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libs/utils/src/namespaces/csv.ts (1)
26-26
: Great fix for the regex pattern!This change correctly addresses the issue with parsing LinkedIn array links. The previous pattern was incorrectly trying to match a closing bracket at the end, which resulted in malformed links like
https://google.com]
that failed Zod schema validation.A small optimization suggestion:
- csvEntry.replace(/^\[/, "").replace(/\]$/, "").split(","); + csvEntry.replace(/^\[/, "").replace(/]$/, "").split(",");The closing square bracket ("]") doesn't need to be escaped outside of a character class, so
/]$/
would work just as well and is slightly cleaner.🧰 Tools
🪛 ESLint
[error] 26-26: /]$/ can be optimized to /]$/.
(unicorn/better-regex)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/utils/src/namespaces/csv.ts
(1 hunks)
🧰 Additional context used
🪛 ESLint
libs/utils/src/namespaces/csv.ts
[error] 26-26: /]$/ can be optimized to /]$/.
(unicorn/better-regex)
The second replace was incorrect, resulting in a link like
https://google.com]
which failed zod validationSummary by CodeRabbit