Skip to content
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

Add name validation to rbx_dom_lua Attributes writer #374

Conversation

kennethloeffler
Copy link
Member

@kennethloeffler kennethloeffler commented Oct 24, 2023

Instance:SetAttribute errors when passed invalid attribute names. The name must:

  • be less than or equal to 100 characters;
  • only contain alphanumeric characters, and in the near future, periods, hyphens, underscores, or forward slashes;
  • must not use the RBX prefix, which is reserved by Roblox.

This PR adds validation to rbx_dom_lua's Attributes custom writer to guard against these, and if any fail, returns false (but will still attempt to set all the attributes). In the future, once Rojo's patch visualizer has more rich display of Attributes values, we could return a more detailed error with specific information about which ones failed.

The alternative is throwing the SetAttribute into a protected call, but eh..

@Dekkonot Dekkonot merged commit 440f372 into rojo-rbx:master Oct 24, 2023
2 checks passed
@kennethloeffler kennethloeffler deleted the rbx-dom-lua-attribute-name-validation branch October 24, 2023 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants