Skip to content

[bug] blocking_pick_files() appears to panic in android #2398

Open
@bburdette

Description

@bburdette

Describe the bug

I'm attempting to use the blocking_pick_files() dialog under android. Looks like it panics. The last log message is "timsg_err 2", right before the function call. The same code works for linux desktop.

#[tauri::command]
pub async fn timsg(
  app_handle: tauri::AppHandle,
  state: State<'_, ZkState>,
  msg: zt::TauriRequest,
) -> Result<zt::TauriReply, ()> {
  info!("timsg");

  match timsg_err(app_handle, state, msg).await {
    Ok(ptd) => {
      info!("we're back1");
      Ok(ptd)
    }
    Err(e) => {
      info!("we're back2");
      Ok(TauriReply::TyServerError(e.to_string()))
    }
  }
}

pub async fn timsg_err(
  app_handle: tauri::AppHandle,
  state: State<'_, ZkState>,
  msg: zt::TauriRequest,
) -> Result<zt::TauriReply, zkerr::Error> {
  info!("timsg_err");

  match msg {
    zt::TauriRequest::TrqUploadFiles => {
      info!("timsg_err 2");

      // show open dialog
      if let Some(flz) = app_handle.dialog().file().blocking_pick_files() {
        info!("dee: {:?}", flz);

        let paths = flz
          .iter()
          .filter_map(|x| x.clone().into_path().ok())
          .collect();

        return make_file_notes(&state, &paths)
          .await
          .map(|fls| zt::TauriReply::TyUploadedFiles(fls));
      } else {
        info!("dee None");
      }
    }
  }

  info!("timsg_err 3");

  Ok(zt::TauriReply::TyUploadedFiles(zt::UploadedFiles {
    notes: Vec::new(),
  }))
}

Reproduction

bburdette/tauri-zknotes@329a69d

directions to build are on the readme.

Expected behavior

Would like to see the file open dialog.

Full tauri info output

[⚠] Environment
    - OS: NixOS 24.11.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.3
    ✔ rsvg2: 2.58.1
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ⚠ rustup: not installed!
      If you have rust installed some other way, we recommend uninstalling it
      then use rustup instead. Visit https://rustup.rs/
    ⚠ Rust toolchain: couldn't be detected!
      Maybe you don't have rustup installed? if so, Visit https://rustup.rs/
    - node: 20.15.1
    - npm: 10.7.0

[-] Packages
    - tauri 🦀: 2.2.5
    - tauri-build 🦀: 2.0.5
    - wry 🦀: 0.48.1
    - tao 🦀: 0.31.1
    - tauri-cli 🦀: 2.0.1

[-] Plugins
    - tauri-plugin-dialog 🦀: 2.2.0
    - tauri-plugin-fs 🦀: 2.2.0

[-] App
    - build-type: bundle
    - CSP: image-src *; media-src *
    - frontendDist: static
    - devUrl: http://0.0.0.0:8080/

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions