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

Fix parsing errors caused by special characters #6455

Conversation

APickledWalrus
Copy link
Member

Description

This PR fixes an issue that could occur with the keyword search (#5103) system that caused valid code with special characters to fail to parse.

This issue is caused by the fact that the problematic code assumes String#toLowerCase will result in a String of the same length, which is not guaranteed. As a result, the used and returned indices do not align between the regular and converted strings.

To correct this issue, I have moved the code away from using lowercase conversion. Instead, it uses String#regionMatches (case-insensitive) instead of String#startsWith with String#toLowerCase to accomplish the same thing.

Test included! :)


Target Minecraft Versions: any
Requirements: none
Related Issues:

@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.8 Targeting a 2.8.X version release labels Feb 22, 2024
Copy link
Member

@Moderocky Moderocky left a comment

Choose a reason for hiding this comment

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

Looks good.

@sovdeeth sovdeeth added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Feb 22, 2024
Copy link
Member

@AyhamAl-Ali AyhamAl-Ali left a comment

Choose a reason for hiding this comment

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

@sovdeeth sovdeeth changed the base branch from master to dev/patch February 24, 2024 18:49
@APickledWalrus APickledWalrus merged commit 20b8981 into SkriptLang:dev/patch Mar 1, 2024
4 checks passed
@APickledWalrus APickledWalrus deleted the patch/special-character-parsing-issues branch March 1, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.8 Targeting a 2.8.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants