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

This commit is contained in:
Jon 2024-07-30 07:35:42 +01:00 committed by GitHub
parent f5722e8823
commit 361b5e7c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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';
@ -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);