Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load asset:// #2965

Closed
antoniotorres opened this issue Nov 25, 2021 · 0 comments
Closed

Cannot load asset:// #2965

antoniotorres opened this issue Nov 25, 2021 · 0 comments
Assignees

Comments

@antoniotorres
Copy link

Describe the bug

Trying to read a local file with fetch, but the request fails due to CORS error.

import { convertFileSrc } from "@tauri-apps/api/tauri";

...

const conv = convertFileSrc("DICOM_FILES/serie_0/IM0");
console.log(conv);
const test = await fetch(conv);
console.log(test);

To Reproduce

Steps to reproduce the behavior:

  1. yarn create tauri-app
  2. Create folder with static files inside src-tauri where the app is running
  3. Try to read the file

Expected behavior

Able to fetch to local file

Screenshots

image

Platform and Versions (required):

yarn tauri info
yarn run v1.22.10
warning package.json: No license field
warning ../package.json: No license field
$ tauri info
 app:spawn Running "/Users/antonio/tauri-app/node_modules/@tauri-apps/cli/bin/tauri-cli tauri info" +0ms


Operating System - Mac OS, version 12.0.1 X64

Node.js environment
  Node.js - 12.20.0
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.8
  yarn - 1.22.10

Rust environment
  rustc - 1.53.0
  cargo - 1.53.0

App directory structure
/dist
/node_modules
/src-tauri
/src

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src asset: blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../dist
  devPath - http://localhost:3000
  framework - React

✨  Done in 5.47s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants