Skip to content

malformed URLs when they are parsed from properties #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nionis opened this issue Apr 1, 2025 · 4 comments · May be fixed by #622
Open

malformed URLs when they are parsed from properties #618

nionis opened this issue Apr 1, 2025 · 4 comments · May be fixed by #622
Labels

Comments

@nionis
Copy link

nionis commented Apr 1, 2025

Steps to Reproduce

Set any youtube video URL as property in tiled.

Expected Result

Once parsed by the plugin, the URL should be the same (including casing)

Actual Result

URL is in small caps, making the video unplayable

Environment

  • browsers and versions:
  • operating system:
  • Tiled version:
  • Excalibur versions:
  • Tiled plugin versions:
  • (anything else that may be relevant)

tiled plugin v0.30.2

Current Workaround

N/A

Theory

My guess the issue stems from the code that makes case insensitive search possible.

const copyPropsLowerCase = (properties: Map<string, string | number | boolean>) => {
const lowercase = new Map<string, string | number | boolean>();
for (let [key, value] of properties) {
let normalizedValue = value;
if (typeof value === 'string') {
normalizedValue = value.toLocaleLowerCase();
}
lowercase.set(key.toLocaleLowerCase(), normalizedValue);
}
return lowercase;
}

@eonarheim
Copy link
Member

@nionis Good find, this is definitely undesirable... we didn't think about creative encodings including casing!

@eonarheim eonarheim added the bug label Apr 1, 2025
@eonarheim
Copy link
Member

@nionis I was noodling on this, I'm thinking about either storing both version of the value and having a separate way of retrieving values, or making value casing configurable in the TiledResource constructor. Thoughts?

@nionis
Copy link
Author

nionis commented Apr 3, 2025

If I had to choose, I would store the original value, and allow the user to pass match function.
for example: getEntitiesByProperty(name: string, matchValue: (val: any) => bool)
names are meant to be known and standard, values can be ambiguous, hence the match function

@eonarheim
Copy link
Member

@nionis Awesome suggestion, I've pushed up a PR with that and some other tweaks, needs testing before merging but in theory fixes this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants