Filenames with slashes in volume filtering#1466
Open
yannik131 wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes volume filename filtering for files whose names begin with / (e.g., remote videos), which previously caused routing/errors when the filename pattern contained a leading slash (issue #1123).
Changes:
- Allow the
filenamefilter route parameter to include slashes by widening the route constraint. - URL-encode filename patterns on the frontend before sending them as a path parameter.
- Decode percent-encoded filename patterns in the API controller, and extend test coverage for slash/encoding edge cases.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/php/Http/Controllers/Api/Volumes/Filters/FilenameControllerTest.php | Adds test cases covering leading-slash patterns and percent-encoding behavior. |
| routes/api.php | Updates the filename filter route to accept patterns containing / via a permissive regex. |
| resources/assets/js/volumes/stores/filters.js | Encodes filename patterns before calling the API so leading slashes don’t break routing. |
| resources/assets/js/volumes/cloneForm.vue | Encodes the clone form’s file pattern when querying matching filenames. |
| app/Http/Controllers/Api/Volumes/Filters/FilenameController.php | Decodes percent-encoded patterns server-side before applying filtering logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
mzur
reviewed
May 22, 2026
| $router->get('{id}/files/filter/filename/{pattern}', [ | ||
| 'uses' => 'Filters\FilenameController@index', | ||
| ]); | ||
| ])->where('pattern', '.*'); |
Contributor
Author
There was a problem hiding this comment.
After additional investigation:
- Laravel and vue already encode/decode URI components
- However, laravel decodes the route parameters and throws an exception if the decoded pattern contains invalid characters such as slashes
- 2 possible fixes:
- encode/decode manually on top of vue/laravel encoding/decoding, then laravel can't "see" the invalid characters after decoding the pattern just once
- add the
->where('pattern', '.*');to explicitly allow any characters, including slashes
The second approach is actually cleaner so I'll remove the manual encoding/decoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1123