tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
78.53k stars 2.33k forks source link

[bug] cargo tauri android init fails if the app identifier contains the "fun" top level domain #9743

Closed Almost-Senseless-Coder closed 5 days ago

Almost-Senseless-Coder commented 3 weeks ago

Describe the bug

Suppose we have an app identifier like fun.game. Then cargo tauri android init fails with the following error message:

thread 'main' panicked at C:\Users\timjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tauri-cli-2.0.0-beta.17\src\mobile\mod.rs:322:6:
called `Result::unwrap()` on an `Err` value: DomainInvalid { domain: "fun", cause: ReservedKeyword { keyword: "fun" } }

This shouldn't happen, as fun is a perfectly valid top level domain, just like online, io or garden.

The issue appears to be that for some reason Rust doesn't see fun as a String, but a keyword, which obviously is prohibited.

Reproduction

Expected behavior

I'd expect the generation of the Android project to complete successfully.

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 124.0.2478.80
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.80.0-nightly (e82c861d7 2024-05-04)
    ✔ cargo: 1.80.0-nightly (05364cb2f 2024-05-03)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.0
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.19
    - tauri-build [RUST]: 2.0.0-beta.15
    - wry [RUST]: 0.39.5
    - tao [RUST]: 0.28.0
    - tauri-cli [RUST]: 2.0.0-beta.17
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.17

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/

### Stack trace

```text
thread 'main' panicked at C:\Users\timjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tauri-cli-2.0.0-beta.17\src\mobile\mod.rs:322:6:
called `Result::unwrap()` on an `Err` value: DomainInvalid { domain: "fun", cause: ReservedKeyword { keyword: "fun" } }


### Additional context

_No response_
pewsheen commented 2 weeks ago

I'm not familiar with Android, but I think that is because fun is a keyword in Kotlin, and will have some problems when building an Android project if it is not escaped properly?

Almost-Senseless-Coder commented 2 weeks ago

I tried it out in Android Studio. Indeed fun.app_name is valid, but gets escaped to `fun`.app_name as the package name.

I'm not sure how to reproduce this in Tauri, or if it's possible to reproduce at all. Writing the app identifier as

"`fun`.app_name"

results in an error because ` isn't ASCII alphanumeric.