Skip to content

NativeHTTPRequest: load a file URL as the file it names - #2116

Open
Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/http-request-file-url
Open

Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/http-request-file-url

Conversation

@Tutez64

@Tutez64 Tutez64 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

On native targets, HTTPRequest reads any URI that is not http(s) as a file
path. A file URL such as file:///home/user/a%20b.txt, which is what
openfl.filesystem.File.url (and AIR's File.url) gives, was therefore never
found: Cannot load file: file:///…. Code written for AIR loads files this
way, for example Starling's AssetManager, which loads the File objects it
is given through their URL.

The file:// scheme is now dropped and the path percent-decoded before it is
read (and, on Windows, the slash before a drive letter removed).

Repro: LimeHTTPRequestFileURLRepro.zip, which saves a file whose name has a space
and loads it through its file URL. Before: FAIL: Cannot load file: file:///…/file%20url%20repro.txt; after: OK: loaded through a file URL.
Checked on neko and on Linux cpp.

Native targets read any URI that is not http(s) as a path, so a file URL (file:///home/user/a%20b.txt, as AIR's File.url gives) was never found. Its scheme is dropped and its path decoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant