Skip to content
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

fix(LinkedIn Node): Fix issue with some characters cutting off posts early #10185

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ export class LinkedIn implements INodeType {
try {
if (resource === 'post') {
if (operation === 'create') {
const text = this.getNodeParameter('text', i) as string;
let text = this.getNodeParameter('text', i) as string;
const shareMediaCategory = this.getNodeParameter('shareMediaCategory', i) as string;
const postAs = this.getNodeParameter('postAs', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);

// LinkedIn uses "little text" https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/little-text-format?view=li-lms-2024-06
text = text.replace(/[\(*\)\[\]\{\}<>@|~_]/gm, (char) => '\\' + char);

let authorUrn = '';
let visibility = 'PUBLIC';

Expand Down Expand Up @@ -264,7 +267,9 @@ export class LinkedIn implements INodeType {
delete body.title;
}
} else {
Object.assign(body, { commentary: text });
Object.assign(body, {
commentary: text,
});
}
const endpoint = '/posts';
responseData = await linkedInApiRequest.call(this, 'POST', endpoint, body);
Expand Down
Loading