Skip to content

Preserve remote URL casing in texture lookup normalization#10013

Open
binbonn wants to merge 10 commits intoFacepunch:masterfrom
binbonn:master
Open

Preserve remote URL casing in texture lookup normalization#10013
binbonn wants to merge 10 commits intoFacepunch:masterfrom
binbonn:master

Conversation

@binbonn
Copy link

@binbonn binbonn commented Feb 11, 2026

Summary

This PR fixes a texture loading issue where <img src="..."> URLs could be lowercased during texture path normalization.
Some remote image paths are case-sensitive, so this could break valid image URLs.

Motivation & Context

Remote URLs and data URIs should preserve their original casing.
The previous normalization path applied lowercase rules intended for local file paths to all texture inputs.

Fixes: #9986

Implementation Details

  • Added NormalizeLookupPath in Texture.Load.cs to centralize lookup normalization behavior.
  • Kept existing lowercase normalization for local file paths.
  • Preserved original casing for:
    • http/https URLs
    • data: URIs
  • Applied the same normalization path in both:
    • LoadInternal (load/cache insert path)
    • Find (cache lookup path)

This keeps cache behavior consistent while preventing URL casing regressions.

Screenshots / Videos (if applicable)

N/A (non-visual fix)

Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • [N/A] Public APIs are documented (if applicable)
  • Unit tests added where applicable and all passing
  • I’m okay with this PR being rejected or requested to change 🙂

Copilot AI review requested due to automatic review settings February 11, 2026 18:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes texture loading/caching behavior so that remote http/https image URLs and data: URIs are no longer lowercased during texture-path normalization, preventing failures when remote paths are case-sensitive (Issue #9986).

Changes:

  • Introduced NormalizeLookupPath to centralize texture cache key normalization.
  • Preserved casing for http/https URLs and data: URIs while keeping local file paths normalized/lowercased.
  • Applied the same normalization logic in both LoadInternal and Find to keep cache insert/lookup consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@binbonn binbonn changed the title Preserve URL casing when loading textures from img src Preserve remote URL casing in texture lookup normalization Feb 13, 2026
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.

IMG Tags Load URLs as Lowercase

1 participant