Skip to content

Commit 548ebd3

Browse files
authored
Merge pull request #24 from Kai-Rowan-the-AI/main
Fix: Handle OSError when hardlinking thumbnails
2 parents aa3bca3 + ed54de9 commit 548ebd3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/services/download_manager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import os
33
import re
4+
import shutil
45
import subprocess
56
import json
67
import time
@@ -227,7 +228,12 @@ def _copy_thumbnail(output_dir: str, video_id: str) -> None:
227228
src = os.path.join(output_dir, f"{video_id}.{ext}")
228229
if os.path.exists(src):
229230
if ext == "jpg":
230-
os.link(src, dest) if not os.path.exists(dest) else None
231+
if not os.path.exists(dest):
232+
try:
233+
os.link(src, dest)
234+
except OSError:
235+
# Fallback to copy if hardlink fails (e.g., different filesystems in Docker)
236+
shutil.copy2(src, dest)
231237
else:
232238
# Convert to jpg using ffmpeg
233239
subprocess.run(

0 commit comments

Comments
 (0)