Skip to content

[bug] assetScope suddenly no longer working? #6158

Description

@frnsys

Describe the bug

I tried upgrading my tauri versions (from 1.2.0) and suddenly can't load any assets. For example, when loading an asset now I get these errors:

asset protocol not configured to allow the path: /home/ftseng/.config/hundun/.thumbs/references.media.environments.coast.rzbu4ds397p91.jpg.jpg

and in the frontend:

[Error] Unhandled Promise Rejection: path not allowed on the configured scope: /home/ftseng/.config/hundun/.thumbs

I've tried a number of different assetScope configs, even trying the complete paths for some of the assets, to no avail:

 "assetScope": ["$APP/*", "$APPCONFIG/*", "$APPDATA/*", "*", "/home/ftseng/.config/hundun/.thumbs/references.media.environments.coast.rzbu4ds397p91.jpg.jpg"]

and

"assetScope": ["$APP/*", "$APPCONFIG/*", "$APPDATA/*", "*",
            "$APP/**", "$APPCONFIG/**", "$APPDATA/**"]

and

"assetScope": ["**"]

This is the url for the example that is being passed to the img tag: "asset://localhost/%2Fhome%2Fftseng%2F.config%2Fhundun%2F.thumbs%2Freferences.media.environments.coast.rzbu4ds397p91.jpg.jpg", produced using convertFileSrc.

I seem to be having a similar issue with the fs.scope config, where I can't iterate over files anymore.

Am I just misconfiguring something? I'm totally stumped.

Reproduction

  1. Try to load the asset in HTML

Expected behavior

The assets to load without issue

Platform and versions

hundun@0.1.0 tauri
tauri "info"

Environment
› OS: Ubuntu 22.04 X64
› Node.js: 18.1.0
› npm: 8.8.0
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.68.0-nightly
› cargo: 1.68.0-nightly
› Rust toolchain: nightly-x86_64-unknown-linux-gnu

Packages
› @tauri-apps/cli [NPM]: 1.2.3
› @tauri-apps/api [NPM]: 1.2.0
› tauri [RUST]: 1.2.4,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.8,
› wry [RUST]: 0.23.4,

App
› build-type: bundle
› CSP: default-src 'self'; img-src 'self' asset: https://asset.localhost
› distDir: ../build
› devPath: http://localhost:8080/
› framework: React
› bundler: Webpack

App directory structure
├─ tauri
├─ assets
├─ .git
├─ public
├─ src
├─ node_modules
└─ scripts

Stack trace

No response

Additional context

My complete config:

{
  "$schema": "../node_modules/@tauri-apps/cli/schema.json",
  "build": {
    "beforeBuildCommand": "npm run build",
    "beforeDevCommand": "npm run start",
    "devPath": "http://localhost:8080",
    "distDir": "../build"
  },
  "package": {
    "productName": "hundun",
    "version": "0.1.0"
  },
  "tauri": {
    "allowlist": {
      "shell": {
        "open": true
      },
      "dialog": {
        "all": true
      },
      "protocol": {
        "asset": true,
        "assetScope": ["**", "**/*"]
      },
      "fs": {
        "all": true,
        "scope": ["**", "**/*"]
      },
      "path": {
        "all": true
      }
    },
    "bundle": {
      "active": true,
      "category": "DeveloperTool",
      "copyright": "",
      "deb": {
        "depends": []
      },
      "externalBin": [],
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "identifier": "hundun",
      "longDescription": "",
      "macOS": {
        "entitlements": null,
        "exceptionDomain": "",
        "frameworks": [],
        "providerShortName": null,
        "signingIdentity": null
      },
      "resources": [],
      "shortDescription": "",
      "targets": "all",
      "windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": ""
      }
    },
    "security": {
      "csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost"
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "hundun",
        "width": 800
      }
    ]
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: 1 highHigh priority bugs/missing features or non-crashing regressionsstatus: needs triageThis issue needs to triage, applied to new issuestype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions