Search Issue Tracker
By Design
Votes
1
Found in
2020.3.47f1
2021.3.24f1
2022.2.17f1
2023.1.0b14
2023.2.0a12
Issue ID
UUM-34301
Regression
No
"HTTP/1.1 404 Not Found" error is thrown when trying to copy a file using UnityWebRequest with a "#" symbol in the URL
Reproduction steps:
1. Open the attached “My project (14).zip“ project
2. Open the “SampleScene” scene
3. Enter Play mode and observe the Console
Expected result: No errors are thrown
Actual result: “HTTP/1.1 404 Not Found UnityEngine.Debug:LogError (object)” error is thrown
Reproducible with: 2020.3.47f1, 2021.3.24f1, 2022.2.17f1, 2023.1.0b14, 2023.2.0a12
Reproduced on: Windows 11
Not reproduced on: macOS Monterey 12.6 (Intel)
Note: Also reproducible in Build
Comments (1)
-
EP-Toushirou
Apr 27, 2023 09:29
how about add support for 'file:///', because it's an obviously local file.
or explain on script api document of 'UnityWebRequest.Get', let more developer know.
Thanks.
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
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Resolution Note:
The '#' symbol has a special meaning in URL - a fragment. It denotes that section in file the client should "scroll to", like in this URL:
https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_LOW
So UnityWebRequest is actually trying to download a file pointed by URI up to the '#', we can't possibly have any scroll support as we don't handle presentation.
The ASCII code for '#' is 23, so replacing '#' with '%23' should work.
You may also try passing the full file path to System.Uri, hopefully it escapes it correctly. UWR does support Uri as an alternative to string.
file:// not necessarily means local file, it can be a file on a network share, at least on Windows we should support that.
As long as passing System.Uri works, we don't intend any more complex support for URIs passed as string. It is advised to use Uri class, as there are many corner cases and often made mistakes with string, for example the mentioned "file:///" is wrong, it is the correct thing to prepend on Windows, but not on other OSes.