From eed3085a3742a340aff0819edf3d8d3b60e52f40 Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Thu, 3 Jul 2025 23:27:07 +0100 Subject: [PATCH] fix panic looking for extension in multibyte unicode paths (#19933) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective ``` 2025-07-03T11:48:34.039501Z ERROR panic: thread 'IO Task Pool (6)' panicked at 'byte index 9 is not a char boundary; it is inside '个' (bytes 7..10) of `展示_个人收款码.png`': [...]\crates\bevy_asset\src\path.rs:475 ``` ## Solution char_indices --- crates/bevy_asset/src/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index 3f780e3fb7..ed189a683b 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -480,7 +480,7 @@ impl<'a> AssetPath<'a> { } pub(crate) fn iter_secondary_extensions(full_extension: &str) -> impl Iterator { - full_extension.chars().enumerate().filter_map(|(i, c)| { + full_extension.char_indices().filter_map(|(i, c)| { if c == '.' { Some(&full_extension[i + 1..]) } else {