Files
ragflow/api/utils
Ricardo-M-L 48b4aa3e93 Fix WebDriver resource leak in HTML-to-PDF conversion (#14310)
### What problem does this PR solve?

In `api/utils/web_utils.py`, `__get_pdf_from_html()` creates a Chrome
WebDriver but only calls `driver.quit()` inside the `TimeoutException`
handler. If the page element becomes stale before the timeout (no
exception raised), the WebDriver is never quit, leaking the Chrome
browser process and returning `None`.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

### Changes

- Move the PDF printing logic and `driver.quit()` outside the `except`
block so they execute on all code paths
- Use `try/finally` to ensure `driver.quit()` is always called, even if
the `Page.printToPDF` DevTools call fails

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:28:58 +08:00
..
2025-11-16 19:29:20 +08:00
2025-11-03 20:25:02 +08:00
2025-12-10 13:34:08 +08:00