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

Call dup on input to #fragment before preprocessing #128

Merged
merged 1 commit into from
Feb 4, 2015
Merged

Call dup on input to #fragment before preprocessing #128

merged 1 commit into from
Feb 4, 2015

Conversation

AnchorCat
Copy link

The introduction of this #preprocess method in
bf0d753 broke sanitisation of frozen
strings (for example, hash keys). The reason this was not a problem
previously is that after #preprocess is called, the input is only ever
used by interpolation into another string, so it never matters that the
object is itself frozen.

This patch has the input stringified and duplicated at the start of
preprocessing. I suspect that was already the intent, since this line
of code already stringified and duplicated it, but then threw the
result away. The only actual change here is assigning the result to the
input variable instead.

This commit also adds a test to ensure that #fragment always works on a
frozen input string.

The introduction of this #preprocess method in
bf0d753 broke sanitisation of frozen
strings (for example, hash keys). The reason this was not a problem
previously is that after #preprocess is called, the input is only ever
used by interpolation into another string, so it never matters that the
object is itself frozen.

This patch has the input stringified and duplicated at the start of
preprocessing. I suspect that was already the intent, since this line
of code already stringified and duplicated it, but then threw the
result away. The only actual change here is assigning the result to the
input variable instead.

This commit also adds a test to ensure that #fragment always works on a
frozen input string.
@rgrove rgrove merged commit 7a43f1d into rgrove:master Feb 4, 2015
rgrove added a commit that referenced this pull request Feb 4, 2015
@rgrove
Copy link
Owner

rgrove commented Feb 4, 2015

Whoops. Thanks! I've released Sanitize 3.1.1 with this fix.

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.

None yet

2 participants