Skip to content

fix: custom background file picker shows an empty file dialog#62221

Open
mvanhorn wants to merge 1 commit into
nextcloud:masterfrom
mvanhorn:fix/62105-custom-background-file-picker
Open

fix: custom background file picker shows an empty file dialog#62221
mvanhorn wants to merge 1 commit into
nextcloud:masterfrom
mvanhorn:fix/62105-custom-background-file-picker

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

This is a regression introduced by commit 15c336f (2026-07-01, "adjust file picker for background image to allow folder navigation"), which replaced the working image filter .setFilter((node) => node.mime.startsWith('image/')) with .setMimeTypeFilter(['image/*']) in the pickFile() function. The intent of that change was correct (a bare setFilter predicate hides folders too, so users could not navigate into subfolders), but the ['image/*'] mimetype-filter path yields an empty browse list in practice, while the other image picker in the codebase (apps/settings/src/components/PersonalInfo/AvatarSection.vue) uses explicit types ['image/png', 'image/jpeg'] rather than the glob. Fix pickFile() by restoring a working image filter that also keeps directories visible for navigation: replace .setMimeTypeFilter(['image/*']) with a folder-aware predicate .setFilter((node) => node.type === 'folder' || node.mime?.startsWith('image/')) (this mirrors the FilePicker's own internal rule of always showing folders plus matching files, and restores the pre-regression image display without reintroducing the folder-navigation problem). This is the delta versus the 2026-07-01 change: it keeps folder navigation but stops the browse list from coming back empty. The fix is self-contained in UserSectionBackground.vue; its only consumer, apps/theming/src/views/UserTheming.vue, needs no change. Add a focused unit test that mocks @nextcloud/dialogs (to capture the filter callback passed to the builder) and @nextcloud/initial-state (the component reads several loadState values at module load), then asserts the predicate accepts a folder node and an image/png node and rejects a text/plain node.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests are included
  • Screenshots before/after for front-end changes
  • Documentation has been updated or is not required
  • Backports requested where applicable
  • Labels added where applicable
  • Milestone added for target branch/version

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
@mvanhorn mvanhorn requested a review from a team as a code owner July 16, 2026 04:55
@mvanhorn mvanhorn requested review from nfebe, skjnldsv and sorbaugh and removed request for a team July 16, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: can not select custom background

1 participant