Skip to content

[bug] Asset protocol not configured to allow the path #3592

@Worble

Description

@Worble

Describe the bug

I am attempting to retrieve Icons for the users currently installed applications. I already have the icon paths (under /usr/share/icons and /usr/share/pixmaps) and I am trying to use convertFileSrc so they can be shown in an image, however no matter what I try I get the error asset protocol not configured to allow the path: <path>.

I have my allowlist set as follows:

    "allowlist": {
      "fs": {
        "readFile": true,
        "readDir": true
      },
      "protocol": {
        "asset": true,
        "assetScope": ["/usr/share/icons/**/*.svg"]
      }
    },

And protocol-asset is added in tauri features in Cargo.toml

Some examples are /usr/share/icons/breeze/apps/48/okular.svg and /usr/share/icons/breeze/apps/48/gwenview.svg. I know the glob is correct since I'm already using it elsewhere in my application to find the icons. I've tried many different variations of the glob such as just the folder /usr/share/icons/** or /usr/share/icons/**/* and nothing appears to be working, as well as just putting in the direct path to the svg to see if it would load. Am I missing something?

Reproduction

No response

Expected behavior

No response

Platform and versions

Operating System - Arch Linux, version Rolling Release X64

Node.js environment
  Node.js - 17.6.0
  @tauri-apps/cli - 1.0.0-rc.5
  @tauri-apps/api - 1.0.0-rc.1

Global packages
  npm - 8.5.2
  pnpm - Not installed
  yarn - Not installed

Rust environment
  rustup - 1.24.3
  rustc - 1.59.0
  cargo - 1.59.0
  toolchain - stable-x86_64-unknown-linux-gnu 

App directory structure
/.idea
/src-tauri
/src
/node_modules
/.git
/dist

App
  tauri - 1.0.0-rc.3
  tauri-build - 1.0.0-rc.3
  tao - 0.6.3
  wry - 0.13.3
  build-type - bundle
  CSP - default-src 'self' blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self' asset: https://asset.localhost
  distDir - ../dist
  devPath - http://localhost:8080/
  framework - React
  bundler - Webpack

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions