Skip to content

Commit

Permalink
Fix(LinkedIn Node): Fix issue with some characters cutting off posts …
Browse files Browse the repository at this point in the history
…early
  • Loading branch information
Joffcom committed Jul 25, 2024
1 parent 520f231 commit c543205
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit c543205

Please sign in to comment.