Skip to content

fix(personalization): remove all files filter from wallpaper dialog#3304

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fileselect
Jun 17, 2026
Merged

fix(personalization): remove all files filter from wallpaper dialog#3304
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fileselect

Conversation

@mhduiy

@mhduiy mhduiy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
  1. Remove "All files (*)" option from wallpaper file dialog
  2. Only allow image file types to be selected (*.png, *.jpg, etc.)
  3. Prevent users from accidentally selecting non-image files

Log: Remove "All files" filter from wallpaper file chooser dialog

fix(personalization): 移除壁纸对话框的全部文件筛选项

  1. 移除壁纸文件对话框中的"所有文件"选项
  2. 仅允许选择图片文件类型(*.png, *.jpg 等)
  3. 防止用户意外选择非图片文件

Log: 移除壁纸文件选择对话框中的"全部文件"筛选项

Summary by Sourcery

Bug Fixes:

  • Prevent selecting non-image files when choosing a custom wallpaper by limiting the file dialog filter to image file types only.

@sourcery-ai

sourcery-ai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Limits the wallpaper selection dialog to image files by removing the generic "All files" filter from the file chooser.

Flow diagram for restricted wallpaper file selection

flowchart TD
    User[User opens wallpaper dialog]
    Dialog[Wallpaper FileDialog shows image-only filter]
    Select[User selects file with image extension]
    Accept[FileDialog onAccepted]
    AddWallpaper[dccData.worker.addCustomWallpaper]

    User --> Dialog
    Dialog --> Select
    Select --> Accept
    Accept --> AddWallpaper
Loading

File-Level Changes

Change Details Files
Restricts the wallpaper file dialog to only show image file types and disallows selecting arbitrary file types.
  • Updated the FileDialog nameFilters list to remove the generic "All files (*)" entry.
  • Kept only the image-specific filter for common formats (PNG, JPG, JPEG, BMP, TIFF) in the wallpaper selection dialog.
src/plugin-personalization/qml/WallpaperPage.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • If the wallpaper backend supports additional common image formats (e.g., GIF, WebP, HEIC), consider adding them to the nameFilters list so the dialog remains consistent with the supported types.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If the wallpaper backend supports additional common image formats (e.g., GIF, WebP, HEIC), consider adding them to the nameFilters list so the dialog remains consistent with the supported types.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码实现了文件选择过滤器的严格限制,有效防止非图片文件传入后端处理。
逻辑正确且提升了前端防御能力,无任何缺陷,给予高分。

■ 【详细分析】

  • 1.语法逻辑(正确)✓

WallpaperPage.qml 第228行的 nameFilters 属性修改符合 QML 标准数组赋值语法,移除元素后数组结构依然合法。
潜在问题:无
建议:无

  • 2.代码质量(良好)✓

移除了冗余且容易误导用户的 "All files (*)" 选项,使组件行为与标题 "Choose an Image File" 语义保持高度一致,符合 UI 规范。
潜在问题:无
建议:无

  • 3.代码性能(无性能问题)✓

仅修改了静态配置数组,不涉及任何运行时计算或资源消耗。
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
修改收窄了前端文件选择范围,降低了非预期文件类型被传入 addCustomWallpaper 函数的攻击面,属于安全加固操作,未引入新风险。

  • 建议:保持当前严格过滤策略,并确保后端 dccData.worker.addCustomWallpaper 函数内部依然保留对文件头魔数的校验,形成前后端双重防御。

■ 【改进建议代码示例】

--- a/src/plugin-personalization/qml/WallpaperPage.qml
+++ b/src/plugin-personalization/qml/WallpaperPage.qml
@@ -225,7 +225,8 @@ DccObject {
             FileDialog {
                 id: customWallpaperFileDialog
                 title: "Choose an Image File"
-                nameFilters: ["Image files (*.png *.jpg *.jpeg *.bmp *.tiff)", "All files (*)"]
+                // 移除"所有文件"选项,防止非图片格式传入 addCustomWallpaper 处理异常
+                nameFilters: ["Image files (*.png *.jpg *.jpeg *.bmp *.tiff)"]
                 fileMode: FileDialog.OpenFile
                 onAccepted: {
                     dccData.worker.addCustomWallpaper(customWallpaperFileDialog.selectedFile)

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Remove "All files (*)" option from wallpaper file dialog
2. Only allow image file types to be selected (*.png, *.jpg, etc.)
3. Prevent users from accidentally selecting non-image files

Log: Remove "All files" filter from wallpaper file chooser dialog

fix(personalization): 移除壁纸对话框的全部文件筛选项

1. 移除壁纸文件对话框中的"所有文件"选项
2. 仅允许选择图片文件类型(*.png, *.jpg 等)
3. 防止用户意外选择非图片文件

Log: 移除壁纸文件选择对话框中的"全部文件"筛选项
pms: BUG-365845
pms: BUG-365849
@mhduiy

mhduiy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit b033073 into linuxdeepin:master Jun 17, 2026
16 of 19 checks passed
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.

3 participants