[PR #1295] [CLOSED] Fix file browser breaking with special characters in filenames #1309

Closed
opened 2026-02-04 19:35:32 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pelican-dev/panel/pull/1295
Author: @Scvtt
Created: 4/24/2025
Status: Closed

Base: mainHead: file-browser


📝 Commits (6)

  • f226402 Implement base64 encoding for safe filename handling
  • 34de07d Update file operations to handle special characters
  • 812445d correct parameter order in renameFiles call
  • 5eff4b2 Remove unnecessary whitespace
  • 9707e35 fix plint issues
  • 8fab9b5 Merge branch 'pelican-dev:main' into file-browser

📊 Changes

2 files changed (+70 additions, -42 deletions)

View changed files

📝 app/Filament/Server/Resources/FileResource/Pages/ListFiles.php (+63 -41)
📝 app/Models/File.php (+7 -1)

📄 Description

Summary

Fixed an issue where the file browser would become unusable after uploading or handling files with special characters (like quotes) in their names. The issue was caused by unescaped special characters breaking JavaScript execution in the frontend.

Technical Changes

  1. Modified the File model to handle special characters safely:

    • Added base64 encoding for filenames in internal representation
    • Added separate display_name field for UI display
    • Updated schema to support the new data structure
  2. Updated ListFiles implementation:

    • Changed table column to use display_name for showing filenames
    • Added base64 decode/encode handling for all file operations
    • Updated all file actions to use decoded filenames
  3. File operations now properly handle special characters:

    • Rename
    • Move
    • Copy
    • Delete
    • Archive/Unarchive
    • Permissions changes
    • Bulk operations

Impact

  • Users can now upload and manage files with special characters in their names
  • File browser remains functional after handling such files
  • Original filenames are preserved and displayed correctly
  • All file operations work properly with special characters
  • Navigation and UI interactions remain smooth

Testing

Verified working with filenames containing:

  • Single quotes
  • Double quotes
  • Other special characters

Fixes Issue #1211


🔄 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/pelican-dev/panel/pull/1295 **Author:** [@Scvtt](https://github.com/Scvtt) **Created:** 4/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `file-browser` --- ### 📝 Commits (6) - [`f226402`](https://github.com/pelican-dev/panel/commit/f226402873ef481e868dbf59abcd9ac8c7b48c2a) Implement base64 encoding for safe filename handling - [`34de07d`](https://github.com/pelican-dev/panel/commit/34de07d3517b1e960074e0c972cc21c1493dec29) Update file operations to handle special characters - [`812445d`](https://github.com/pelican-dev/panel/commit/812445da1cb6876aa60ba52bb43eefe2e73729af) correct parameter order in renameFiles call - [`5eff4b2`](https://github.com/pelican-dev/panel/commit/5eff4b2141fc7dd1451570174c5a9bbfe306ac0e) Remove unnecessary whitespace - [`9707e35`](https://github.com/pelican-dev/panel/commit/9707e353751ce8f79d6754e18c497b5ff60e2524) fix plint issues - [`8fab9b5`](https://github.com/pelican-dev/panel/commit/8fab9b5fae889b4606d1e8022fdf15800c1aa70f) Merge branch 'pelican-dev:main' into file-browser ### 📊 Changes **2 files changed** (+70 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `app/Filament/Server/Resources/FileResource/Pages/ListFiles.php` (+63 -41) 📝 `app/Models/File.php` (+7 -1) </details> ### 📄 Description ## Summary Fixed an issue where the file browser would become unusable after uploading or handling files with special characters (like quotes) in their names. The issue was caused by unescaped special characters breaking JavaScript execution in the frontend. ## Technical Changes 1. Modified the File model to handle special characters safely: - Added base64 encoding for filenames in internal representation - Added separate `display_name` field for UI display - Updated schema to support the new data structure 2. Updated ListFiles implementation: - Changed table column to use `display_name` for showing filenames - Added base64 decode/encode handling for all file operations - Updated all file actions to use decoded filenames 3. File operations now properly handle special characters: - Rename - Move - Copy - Delete - Archive/Unarchive - Permissions changes - Bulk operations ## Impact - Users can now upload and manage files with special characters in their names - File browser remains functional after handling such files - Original filenames are preserved and displayed correctly - All file operations work properly with special characters - Navigation and UI interactions remain smooth ## Testing Verified working with filenames containing: - Single quotes - Double quotes - Other special characters ## Related Issues Fixes [Issue #1211](https://github.com/pelican-dev/panel/issues/1211) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-04 19:35:32 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/panel#1309