Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions apps/backend/app/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,33 @@ def _resolve_pdf_margins(margins: Optional[dict]) -> dict:


def _find_chromium_executable() -> Optional[str]:
if sys.platform != "win32":
return None
candidates = [
Path(os.environ.get("PROGRAMFILES", "C:/Program Files"))
/ "Google/Chrome/Application/chrome.exe",
Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)"))
/ "Google/Chrome/Application/chrome.exe",
Path(os.environ.get("PROGRAMFILES", "C:/Program Files"))
/ "Microsoft/Edge/Application/msedge.exe",
Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)"))
/ "Microsoft/Edge/Application/msedge.exe",
]
"""Find system Chrome/Chromium/Edge executable across platforms."""
if sys.platform == "win32":
candidates = [
Path(os.environ.get("PROGRAMFILES", "C:/Program Files"))
/ "Google/Chrome/Application/chrome.exe",
Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)"))
/ "Google/Chrome/Application/chrome.exe",
Path(os.environ.get("PROGRAMFILES", "C:/Program Files"))
/ "Microsoft/Edge/Application/msedge.exe",
Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)"))
/ "Microsoft/Edge/Application/msedge.exe",
]
else:
# Linux/macOS paths
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/backend/app/pdf.py, line 87:

<comment>macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.</comment>

<file context>
@@ -71,18 +71,33 @@ def _resolve_pdf_margins(margins: Optional[dict]) -> dict:
+            / "Microsoft/Edge/Application/msedge.exe",
+        ]
+    else:
+        # Linux/macOS paths
+        candidates = [
+            Path("/usr/bin/google-chrome"),
</file context>
Fix with Cubic

candidates = [
Path("/usr/bin/google-chrome"),
Path("/usr/bin/google-chrome-stable"),
Path("/usr/bin/chromium"),
Path("/usr/bin/chromium-browser"),
Path("/usr/bin/microsoft-edge"),
Path("/snap/bin/chromium"),
Path("/var/lib/flatpak/exports/bin/com.google.Chrome"),
Path("/var/lib/flatpak/exports/bin/org.chromium.Chromium"),
Path(os.path.expanduser("~/.local/share/flatpak/exports/bin/com.google.Chrome")),
Path(os.path.expanduser("~/.local/share/flatpak/exports/bin/org.chromium.Chromium")),
]

for candidate in candidates:
if candidate.exists():
return str(candidate)
Expand Down