File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
libraries/nestjs-libraries/src/integrations/social Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,12 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
423423 let mediaBuffer : Buffer ;
424424
425425 // Check if media has a buffer (from PDF conversion)
426- if ( 'buffer' in media && Buffer . isBuffer ( ( media as any ) . buffer ) ) {
426+ if (
427+ media &&
428+ typeof media === 'object' &&
429+ 'buffer' in media &&
430+ Buffer . isBuffer ( media . buffer )
431+ ) {
427432 mediaBuffer = ( media as any ) . buffer ;
428433 } else {
429434 mediaBuffer = await this . prepareMediaBuffer ( media . url ) ;
@@ -525,14 +530,14 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
525530 firstPost : PostDetails ,
526531 mediaIds : string [ ] ,
527532 type : 'company' | 'personal' ,
528- idPdf : boolean
533+ isPdf : boolean
529534 ) : Promise < string > {
530535 const postPayload = this . createLinkedInPostPayload (
531536 id ,
532537 type ,
533538 firstPost . message ,
534539 mediaIds ,
535- idPdf ,
540+ isPdf
536541 ) ;
537542
538543 const response = await this . fetch ( 'https://api.linkedin.com/rest/posts' , {
@@ -546,7 +551,6 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
546551 body : JSON . stringify ( postPayload ) ,
547552 } ) ;
548553
549- console . log ( 'LinkedIn post response:' , response ) ;
550554 if ( response . status !== 201 && response . status !== 200 ) {
551555 throw new Error ( 'Error posting to LinkedIn' ) ;
552556 }
You can’t perform that action at this time.
0 commit comments