-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Linkedin - escape characters in posts #17615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “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? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThe changes introduce a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LinkedInAction
participant Utils
User->>LinkedInAction: Submit post with text (may include special chars)
LinkedInAction->>Utils: escapeText(text)
Utils-->>LinkedInAction: Escaped text
LinkedInAction->>LinkedIn API: Send post with escaped commentary
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/linkedin/actions/create-image-post-user/create-image-post-user.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/linkedin/actions/delete-post/delete-post.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: 2
♻️ Duplicate comments (3)
components/linkedin/actions/get-member-profile/get-member-profile.mjs (1)
7-7: Same remark as previous fileEnsure the
0.1.7bump is mirrored in package metadata / changelog.components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs (1)
7-7: Same remark as previous fileEnsure the
0.1.7bump is mirrored in package metadata / changelog.components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs (1)
7-7: Same remark as previous fileEnsure the
0.1.7bump is mirrored in package metadata / changelog.
🧹 Nitpick comments (8)
components/linkedin/actions/delete-post/delete-post.mjs (1)
7-7: Version bump acknowledged—remember supporting artifactsThe increment to
0.0.7is fine.
Double-check that:
components/linkedin/package.json(or monorepo equivalent) reflects the same version set, and- CHANGELOG / release notes mention this bump so consumers know nothing but cosmetic changes occurred.
components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs (1)
7-7: Minor semantic-version bump—verify consistencyGoing from
1.0.0→1.0.1signals a patch change.
Confirm that no breaking changes slipped in elsewhere and that the rootpackage.json& docs show1.0.1.components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs (1)
7-7: Remember to update the public changelog
Consider adding a brief entry summarizing the escape-character fix that motivated this release so users can trace the reason for0.1.7.components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs (1)
7-7: Changelog entry recommended
Add a bullet to the LinkedIn integration changelog to maintain transparency on this release.components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs (1)
7-7: Ensure docs stay in sync
Double-check that any external docs/examples reference the new version where applicable.components/linkedin/actions/get-profile-picture-fields/get-profile-picture-fields.mjs (1)
8-8: Consider semantic versioning clarity
If the only change is escaping characters elsewhere, confirm whether this action truly needs a new version; otherwise note rationale in changelog.components/linkedin/actions/create-like-on-share/create-like-on-share.mjs (1)
7-7: Synchronize release notes
Document this action’s bump alongside others to avoid confusion for downstream users.components/linkedin/common/utils.mjs (1)
51-56: Optimize performance with single regexCreating a new regex for each character is inefficient. Consider using a single regex with alternation for better performance.
Apply this diff to optimize the implementation:
function escapeText(text) { + if (!text || typeof text !== 'string') { + return text; + } - const chars = [ - "\\", - "|", - "{", - "}", - "@", - "[", - "]", - "(", - ")", - "<", - ">", - "#", - "*", - "_", - "~", - ]; - for (const char of chars) { - const escapedChar = "\\" + char; - const regex = new RegExp(`\\${char}`, "g"); - text = text.replace(regex, escapedChar); - } - return text; + return text.replace(/[\\|{}@\[\]()<>#*_~]/g, '\\$&'); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
components/linkedin/actions/create-comment/create-comment.mjs(1 hunks)components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs(2 hunks)components/linkedin/actions/create-image-post-user/create-image-post-user.mjs(2 hunks)components/linkedin/actions/create-like-on-share/create-like-on-share.mjs(1 hunks)components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs(2 hunks)components/linkedin/actions/create-text-post-user/create-text-post-user.mjs(2 hunks)components/linkedin/actions/delete-post/delete-post.mjs(1 hunks)components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs(1 hunks)components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs(1 hunks)components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs(1 hunks)components/linkedin/actions/get-member-profile/get-member-profile.mjs(1 hunks)components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs(1 hunks)components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs(1 hunks)components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs(1 hunks)components/linkedin/actions/get-profile-picture-fields/get-profile-picture-fields.mjs(1 hunks)components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs(1 hunks)components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs(1 hunks)components/linkedin/actions/search-organization/search-organization.mjs(1 hunks)components/linkedin/common/utils.mjs(1 hunks)components/linkedin/package.json(1 hunks)components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
components/linkedin/actions/create-comment/create-comment.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs (1)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (21)
components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs (1)
7-7: Version bump looks correct and consistent
Patch version increment to0.1.7aligns with the coordinated release across other LinkedIn actions.components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs (1)
7-7: Version increment acknowledged
No functional changes detected; patch bump to0.1.7approved.components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs (1)
7-7: Patch bump accepted
versionfield updated to0.1.7; no further issues.components/linkedin/actions/get-profile-picture-fields/get-profile-picture-fields.mjs (1)
8-8: Minor version bump looks fine
0.0.1 → 0.0.2accurately reflects a non-breaking internal enhancement.components/linkedin/actions/create-like-on-share/create-like-on-share.mjs (1)
7-7: Patch version update approved
versionadvanced to0.1.7; implementation unaffected.components/linkedin/actions/search-organization/search-organization.mjs (1)
7-7: LGTM: Routine version bumpThis version increment is appropriate as part of the coordinated LinkedIn component release.
components/linkedin/common/utils.mjs (1)
33-57: Good implementation of character escaping functionalityThe function correctly escapes markdown and formatting characters that could interfere with LinkedIn post rendering. The regex construction properly handles special characters like backslashes and square brackets.
components/linkedin/actions/create-comment/create-comment.mjs (1)
7-7: LGTM: Routine version bumpThis version increment is appropriate as part of the coordinated LinkedIn component release.
components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs (1)
7-7: LGTM: Routine version bumpThis version increment is appropriate as part of the coordinated LinkedIn component release.
components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs (1)
12-12: LGTM: Routine version bumpThis version increment is appropriate as part of the coordinated LinkedIn component release.
components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs (1)
7-7: LGTM - Consistent version bump.The version increment maintains consistency with the package-wide updates without introducing functional changes.
components/linkedin/package.json (1)
3-3: LGTM - Appropriate package version bump.The minor version increment correctly reflects the cumulative updates across the LinkedIn actions and utilities.
components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs (2)
91-91: LGTM - Consistent application of text escaping.The escapeText function is correctly applied to the commentary field to handle special characters in LinkedIn posts, addressing the PR objective.
4-4: escapeText implementation verified and applied consistentlyThe
escapeTextfunction incomponents/linkedin/common/utils.mjscorrectly prefixes all designated special characters with a backslash. It’s imported and used to sanitize thecommentaryfield in all LinkedIn action files:
- components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (line 33)
- components/linkedin/actions/create-image-post-user/create-image-post-user.mjs (line 90)
- components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs (line 34)
- components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs (line 91)
No further changes required.
components/linkedin/actions/create-image-post-user/create-image-post-user.mjs (1)
4-4: LGTM - Consistent text escaping implementation.The utils import and escapeText function application follow the same pattern as other LinkedIn post actions, ensuring consistent handling of special characters.
Also applies to: 90-90
components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs (3)
2-2: LGTM - Consistent text escaping implementation.The utils import and escapeText function application maintain consistency with other LinkedIn post actions for handling special characters.
Also applies to: 34-34
7-7: Minor improvement in description clarity.The change from "docs" to "documentation" improves the professional tone of the description.
2-2: All LinkedIn post actions consistently use escapeTextI’ve verified that the four post‐creation actions under
components/linkedin/actions/—text and image posts for both users and organizations—now all useutils.escapeText(this.text)for thecommentaryfield and that there are no remaining directthis.textusages. No further changes are needed.components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (3)
2-2: LGTM: Import added for escapeText utility.The import statement is correctly structured and necessary for the text escaping functionality.
7-7: LGTM: Description text improved.Good improvement changing "docs" to "documentation" for better clarity.
8-8: LGTM: Version bumped appropriately.Version increment is appropriate for the functional changes made.
Resolves #17353
Summary by CodeRabbit
New Features
Improvements
Bug Fixes