Search Issue Tracker
By Design
By Design in 2023.2.X
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
- VFX Graph Documentation dropdown button does nothing when clicked on the right side
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
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.
Resolution Note (2023.2.X):
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.