[PR #5724] [CLOSED] fix(desktop): prevent white screen when URI handler fails #5329

Closed
opened 2026-03-17 02:47:10 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5724
Author: @GaoSSR
Created: 12/24/2025
Status: Closed

Base: mainHead: fix/desktop-white-screen-issue-5722


📝 Commits (2)

  • 54732cd fix(desktop): prevent white screen by improving error handling in URI handler
  • 98511fc fix(security): escape HTML in error messages to prevent XSS

📊 Changes

2 files changed (+148 additions, -2 deletions)

View changed files

📝 packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs (+66 -1)
📝 packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/uri/handler.rs (+82 -1)

📄 Description

Summary

This PR fixes the white screen issue reported in #5722.

Root Cause

The white screen occurs due to two issues in the tauri-plugin-appload module:

  1. lib.rs:153: Used .unwrap() on the URI handler result, which could panic and crash the webview when the handler fails
  2. handler.rs: Returned an empty 404 response when cache lookup fails, causing the webview to display a blank page

Changes

  • lib.rs: Replaced .unwrap() with a match statement that catches errors and returns a user-friendly error page with a reload button
  • handler.rs: Added comprehensive error handling that displays a styled error page with technical details instead of an empty response

Before

When the cache lookup fails or URI handler encounters an error, the app shows a blank white screen with no indication of what went wrong.

After

Users now see a helpful error page with:

  • Clear error message explaining what happened
  • A "Reload" button to retry
  • Technical details for debugging

Test Plan

  • Build the desktop app with these changes
  • Simulate cache failures to verify error pages display correctly
  • Verify normal operation is not affected
  • Test on macOS/Windows/Linux

Closes #5722


Summary by cubic

Prevents the desktop app from turning into a white screen when the URI handler fails by serving a helpful error page and avoiding panics; also escapes error details to prevent XSS. Fixes #5722 and #5716.

  • Bug Fixes
    • lib.rs: replaced unwrap with error handling; returns a 500 HTML error page with a reload button and logs the error.
    • uri/handler.rs: replaced empty 404 with a styled 500 HTML error page showing host, path, and error details.

Written for commit 98511fca1b. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5724 **Author:** [@GaoSSR](https://github.com/GaoSSR) **Created:** 12/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/desktop-white-screen-issue-5722` --- ### 📝 Commits (2) - [`54732cd`](https://github.com/hoppscotch/hoppscotch/commit/54732cd02658599453dec3f7b5a879aeff41ad04) fix(desktop): prevent white screen by improving error handling in URI handler - [`98511fc`](https://github.com/hoppscotch/hoppscotch/commit/98511fca1bec7275a0eb12472b3ed86a64029113) fix(security): escape HTML in error messages to prevent XSS ### 📊 Changes **2 files changed** (+148 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs` (+66 -1) 📝 `packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/uri/handler.rs` (+82 -1) </details> ### 📄 Description ## Summary This PR fixes the white screen issue reported in #5722. ### Root Cause The white screen occurs due to two issues in the `tauri-plugin-appload` module: 1. **`lib.rs:153`**: Used `.unwrap()` on the URI handler result, which could panic and crash the webview when the handler fails 2. **`handler.rs`**: Returned an empty 404 response when cache lookup fails, causing the webview to display a blank page ### Changes - **`lib.rs`**: Replaced `.unwrap()` with a `match` statement that catches errors and returns a user-friendly error page with a reload button - **`handler.rs`**: Added comprehensive error handling that displays a styled error page with technical details instead of an empty response ### Before When the cache lookup fails or URI handler encounters an error, the app shows a blank white screen with no indication of what went wrong. ### After Users now see a helpful error page with: - Clear error message explaining what happened - A "Reload" button to retry - Technical details for debugging ## Test Plan - [ ] Build the desktop app with these changes - [ ] Simulate cache failures to verify error pages display correctly - [ ] Verify normal operation is not affected - [ ] Test on macOS/Windows/Linux Closes #5722 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevents the desktop app from turning into a white screen when the URI handler fails by serving a helpful error page and avoiding panics; also escapes error details to prevent XSS. Fixes #5722 and #5716. - **Bug Fixes** - lib.rs: replaced unwrap with error handling; returns a 500 HTML error page with a reload button and logs the error. - uri/handler.rs: replaced empty 404 with a styled 500 HTML error page showing host, path, and error details. <sup>Written for commit 98511fca1bec7275a0eb12472b3ed86a64029113. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:47:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5329
No description provided.