tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] [v2] IndexedDB path changed after upgrading to tauri 2

Open hut36 opened this issue 4 months ago • 0 comments

Describe the bug

After upgrading from tauri 1 to tauri 2, the IndexedDB directory changed from https_tauri.localhost_0.indexeddb.leveldb to http_tauri.localhost_0.indexeddb.leveldb. Since my app stores all data in IndexedDB, this will cause "data losing" from user's point of view.

This happens on Windows, the full paths are:

  • C:\Users\[username]\AppData\Local\[appid]\EBWebView\Default\IndexedDB\https_tauri.localhost_0.indexeddb.leveldb
  • C:\Users\[username]\AppData\Local\[appid]\EBWebView\Default\IndexedDB\http_tauri.localhost_0.indexeddb.leveldb

Reproduction

To verify that tauri 2 uses said IndexedDB directory http_tauri.localhost_0.indexeddb.leveldb, following these steps:

  1. create a new app: pnpm create tauri-app
  2. do anything that causes IndexedDB directory being created, for example, using idb: a. pnpm i idb b. open IndexedDB: openDB("test").then((db) => console.log("db opened: ", db));
  3. build: pnpm tauri build --debug
  4. run the app and check the directory

I've set up a repo at https://github.com/hut36/tauri2-indexeddb for you to test.

Expected behavior

The directory https_tauri.localhost_0.indexeddb.leveldb is expected, instead of http_tauri.localhost_0.indexeddb.leveldb. See above for the full path.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 125.0.2535.92
    ✔ MSVC: Visual Studio 生成工具 2022
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.12.0
    - pnpm: 9.10.0
    - yarn: 1.22.22
    - npm: 9.6.3

[-] Packages
    - tauri 🦀: 2.0.1
    - tauri-build 🦀: 2.0.1
    - wry 🦀: 0.44.1
    - tao 🦀: 0.30.3
    - @tauri-apps/api : 2.0.1
    - @tauri-apps/cli : 2.0.1

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.1
    - @tauri-apps/plugin-shell : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Stack trace

No response

Additional context

Related discussion: https://github.com/tauri-apps/tauri/discussions/11231. @FabianLars says this is related to dangerousUseHttpScheme.

hut36 avatar Oct 07 '24 08:10 hut36