Search Issue Tracker
Fixed
Fixed in 2021.3.34f1, 2022.3.16f1, 2023.2.5f1, 2023.3.0a19, 7000.0.0a1
Votes
0
Found in
2021.3.32f1
2022.3.14f1
2023.2.2f1
2023.3.0a16
7000.0.0a1
Issue ID
UUM-57122
Regression
No
Unity fails to load an audio file via web request when the path of the audio file has a "+" in it
The original bug report is by design.
The complain about missing docs is valid. Rescoping the case to add missing method signatures to API docs.
How to reproduce:
1. Open the attached “WebRequestMultimdediaBugRepoTrue.zip“ project
2. Open the “SampleScene“ Scene
3. Enter Play Mode
Expected result: Audio file plays and “Audio file loaded! You should hear it playing.“ text is visible in the Game view
Actual result: Audio file doesn’t play and “Error: HTTP/1.1 404 Not Found“ text is visible in the Game view
Reproducible with: 2021.3.32f1, 2022.3.14f1, 2023.2.2f1, 2023.3.0a16
Reproducible on: macOS 14.0 Sonoma (Intel)
Not reproducible on: No other environment tested
Notes:
- Also reproducible in Player
- The issue is only reproducible with audio files
- The user noted that File.Exists returns “true”
- The user noted that they use the C# built URI class to build a valid local URI and that this helper escapes special reserved characters (for example, converts “Space” into “%20”), but considers the “+” valid
- The user noted that according to the spec on URL encoding RFC 3986, a generic URI uses a subset of reserved characters where the “{+}” is not considered reserved and that the C# implementation confirms this. The “{+}” is generally only interpreted as a “Space” when crafting an “application/x-www-form-urlencoded” type String
- The user noted that they tried testing if Unity was replacing the “+” with “Space”, but weren’t able to make it work
- The user noted that although Unity provides its own method to escape a URL via UnityWebRequest.EscapeURL, they have not found any way to use this to create a valid URI that is accepted by the multimedia request
- The user noted that using EscapeURL on the path before entering it into the URI helper will cause a UriFormatException
- The user noted that using EscapeURL on the output of Uri.absoluteUri will cause Unity to return an “Unable to connect” error
- The user noted that when using "file:///" + UnityWebRequest.EscapeURL(path), the audio file is found, and this works on Windows, but fails on MacOS
- The user noted if the URI of the failed audio file load is copied and pasted into any browser, it will find and play the file
-
Doddler
Nov 30, 2023 01:32
I disagree with this resolution, using a Uri cannot be the recommended method because the unity documentation does not acknowledge that such a method even exists, and the sample code provided by unity also does not use a Uri. Any user attempting to use UnityWebRequestMultimedia based on the documentation will encounter this bug.
Additionally, the + character is valid in a Uri in Chrome, Firefox, Safari, Edge, and even C#'s own Uri class, so I disagree that it should even be unescaped like it is. It would be fine if the Uri version of the method was recommended, but there's no way to even know it exists.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Inaccurate Box Collider boundaries on a rotated child Cube when the parent GameObject Scale is non-uniform
- [Android] "SHADOWS_SCREEN" set as shader Keyword when no "_ShadowMapTexture" is bound leads to freeze on a build on some Mali GPU devices
- Constant console errors when using Min/Max Slider in PlayMode
- The global scene list is overridden in a project built with command line when the Override Global Scene List setting is disabled in the build profile
- [Linux] AutoLocale log is logged when opening a project
Resolution Note (fix version 2023.3.0a19):
Documentation issue - some signatures were missing in API docs.