Skip to content

[bug] dialog.open and convertFileSrc breaks if file name or path contains [ #5234

@MessyComposer

Description

@MessyComposer

Describe the bug

Using dialog.open, if the file or file path opened contains [ (eg. ./pictures/img[test.jpeg , or ./pictures/te[st/img.jpeg)
it will result in the following error:
invalid glob pattern: Pattern syntax error near position 30: invalid range pattern

If the file path closes the [ (eg. ./pictures/img[test].jpeg or even ./pictures/te[st/img].jpeg)
it opens the file as expected, but breaks when trying to display said file, resulting in the following error:
asset protocol not configured to allow the path: C:\...\img[test].jpeg

Other files open and display as expected.

Reproduction

  1. Prepare test files matching the above examples
  2. Create a project
  3. Add file dialog, convert path with convertFileSrc, and set to img src
  4. Try opening and displaying the files

Expected behavior

The files will be opened and displayed just like the others

Platform and versions

Environment
› OS: Windows 10.0.19044 X64
› Webview2: 105.0.1343.42
› MSVC:
- Visual Studio Community 2019
› Node.js: 16.15.1
› npm: 8.11.0
› pnpm: Not installed!
› yarn: 1.22.19
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-x86_64-pc-windows-msvc

Packages
› @tauri-apps/cli [NPM]: 1.1.1
› @tauri-apps/api [NPM]: 1.1.0
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,

App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:1420/
› framework: Vue.js

App directory structure
├─ .vscode
├─ node_modules
├─ public
├─ src
└─ src-tauri

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions