Skip to content

Loader GetURL incorrectly handles file:// absolute URLs, breaking resource loading and Spine atlas page image loading #7216

@aomsir

Description

@aomsir

Description

When running Phaser under the file:// protocol (no local HTTP server),
the Loader incorrectly treats absolute file:// URLs as relative.
As a result, baseURL is prepended to them, producing an invalid
combined URL.

This issue affects:

  1. Manual resource loading using file:// URLs
  2. Spine atlas loading, because page images inside a .atlas file
    often include absolute file:// paths
    • Phaser automatically loads these image URLs\
    • Loader misinterprets them\
    • Resulting URL becomes invalid → image fails to load

Example of incorrect behaviour:

baseURL: file:///Users/me/project/
file.url: file:///Users/me/project/assets/spineboy-pma.png

Result:
file:///Users/me/project/file:///Users/me/project/assets/spineboy-pma.png

This happens because GetURL() does not classify file:// as an
absolute URL, unlike http(s)://, blob:, data:, etc.

Reproduction

1. Basic resource load

this.load.setBaseURL("file:///Users/me/project/");

this.load.image("pic", "file:///Users/me/project/assets/img.png");
// Incorrect: baseURL is prepended to an already absolute file:// URL

2. Spine atlas loading

Inside spineboy.atlas:

file:///Users/me/project/assets/spineboy-pma.png

Phaser automatically loads the page image referenced in the atlas.
But because the URL starts with file://, Loader incorrectly prefixes
baseURL, producing an invalid URL → page image fails to load.

Expected behaviour

  • file:// URLs should be treated as absolute (same as
    http/https/blob/data).
  • Loader should not prepend baseURL to them.
  • Spine atlas auto-loading should correctly load page images
    referenced with absolute file:// URLs.

Affected versions

Phaser every version

Related PR

Fix PR: #7210

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions