mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-23 15:08:13 +02:00
fix: prevent ENOENT on scheduled reel publishing when local file deleted early
- facebook.ts: use resolvePublicUrl + getMediaBuffer for reels so missing local files fall back to HTTP fetch. - scheduler.ts: only delete local video files after the last pending scheduled post for that postId is published. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
37aba33425
commit
d763be6322
2 files changed
+12
-8
No files matched your search
@@ -72,11 +72,9 @@ export class FacebookService {
|
||||
throw new Error('Reels require a video media');
|
||||
}
|
||||
|
||||
// Upload video bytes directly — Facebook cannot fetch local/Docker URLs
|
||||
const localPath = videoMedia.originalUrl.startsWith('/')
|
||||
? path.join(process.cwd(), videoMedia.originalUrl)
|
||||
: videoMedia.originalUrl;
|
||||
const nodeBuffer = await fs.promises.readFile(localPath);
|
||||
// Use public URL so getMediaBuffer can fetch via HTTP if local file is missing
|
||||
const publicUrl = resolvePublicUrl(videoMedia.originalUrl);
|
||||
const nodeBuffer = await this.getMediaBuffer(publicUrl);
|
||||
return await this.publishVideoFromBuffer(page, nodeBuffer, post.content);
|
||||
} else {
|
||||
// Default to feed
|
||||
|
||||
Reference in new issue
Block a user