Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 56 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/tauri-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tauri-winres = "0.3"
semver = "1"
dirs = "6"
glob = "0.3"
toml = "0.8"
toml = "0.9"
# Our code requires at least 0.8.21 so don't simplify this to 0.8
schemars = { version = "0.8.21", features = ["preserve_order"] }

Expand Down
4 changes: 2 additions & 2 deletions crates/tauri-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ notify = "8"
notify-debouncer-full = "0.5"
shared_child = "1"
duct = "1.0"
toml_edit = { version = "0.22", features = ["serde"] }
toml_edit = { version = "0.23", features = ["serde"] }
json-patch = "3"
tauri-utils = { version = "2.6.0", path = "../tauri-utils", features = [
"isolation",
Expand All @@ -65,7 +65,7 @@ tauri-utils = { version = "2.6.0", path = "../tauri-utils", features = [
"config-toml",
"html-manipulation",
] }
toml = "0.8"
toml = "0.9"
jsonschema = "0.32"
handlebars = "6"
include_dir = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tauri-utils = { version = "2.6.0", default-features = false, features = [
], path = "../tauri-utils" }
serde_json = { version = "1", optional = true }
glob = { version = "0.3", optional = true }
toml = { version = "0.8", optional = true }
toml = { version = "0.9", optional = true }
# Our code requires at least 0.8.21 so don't simplify this to 0.8
schemars = { version = "0.8.21", features = ["preserve_order"] }
walkdir = { version = "2", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ getrandom = { version = "0.3", optional = true, features = ["std"] }
serialize-to-javascript = { version = "=0.1.1", optional = true }
ctor = "0.2"
json5 = { version = "0.4", optional = true }
toml = { version = "0.8", features = ["parse"] }
toml = { version = "0.9", features = ["parse"] }
json-patch = "3.0"
# Our code requires at least 0.3.1
glob = "0.3.1"
Expand Down
5 changes: 5 additions & 0 deletions crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ pub enum BundleType {
App,
/// The Apple Disk Image bundle (.dmg).
Dmg,
/// The Flatpak bundle (.flatpak).
Flatpak,
}

impl BundleType {
Expand All @@ -157,6 +159,7 @@ impl BundleType {
BundleType::Nsis,
BundleType::App,
BundleType::Dmg,
BundleType::Flatpak,
]
}
}
Expand All @@ -174,6 +177,7 @@ impl Display for BundleType {
Self::Nsis => "nsis",
Self::App => "app",
Self::Dmg => "dmg",
Self::Flatpak => "Flatpak",
}
)
}
Expand Down Expand Up @@ -202,6 +206,7 @@ impl<'de> Deserialize<'de> for BundleType {
"nsis" => Ok(Self::Nsis),
"app" => Ok(Self::App),
"dmg" => Ok(Self::Dmg),
"flatpak" => Ok(Self::Flatpak),
_ => Err(DeError::custom(format!("unknown bundle target '{s}'"))),
}
}
Expand Down
5 changes: 3 additions & 2 deletions crates/tauri-utils/src/config/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ fn do_parse_json5<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, Conf

#[cfg(feature = "config-toml")]
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
// Parse using toml 0.9's from_str which returns different error types
::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: TOML parse errors misleadingly reported as JSON errors

The do_parse_toml function now maps TOML parse errors to ConfigError::FormatJson instead of the existing ConfigError::FormatToml variant. This means when a user has a malformed Tauri.toml file, they'll see an error message like:

"unable to parse JSON Tauri config file at Tauri.toml because ..."

This is confusing and misleading — the user is editing a TOML file but the error blames JSON parsing. The FormatToml variant still exists in the enum and has the correct error message ("unable to parse toml Tauri config file at {path}").

The underlying issue is that toml 0.9 changed toml::de::Error to a different type that's no longer compatible with Box<toml::de::Error> in FormatToml. The proper fix is to update the FormatToml variant to accept the new error type (e.g., Box<toml::Error>), or use a String/Box<dyn std::error::Error> for the error field — not to silently remap to a JSON error variant.

Additionally, this leaves FormatToml as a dead variant (unreachable in current code), which could confuse future maintainers and break pattern matching if anyone matches on it.

Was this helpful? React with 👍 / 👎

Suggested change
::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
path: path.into(),
error: Box::new(error),
})
  • Apply suggested fix

path: path.into(),
error: Box::new(error),
error: serde_json::Error::custom(error.to_string()),
})
}

Expand Down