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

Update all deps. #228

Closed
wants to merge 8 commits into from
Closed

Conversation

jctanner
Copy link
Contributor

@jctanner jctanner commented Mar 18, 2024

replaced by #230

No-Issue

Signed-off-by: James Tanner <[email protected]>
@AlanCoding
Copy link
Member

Looks relevant because it landed in DRF 3.15.0

encode/django-rest-framework@4abfa28

No-Issue

Signed-off-by: James Tanner <[email protected]>
No-Issue

Signed-off-by: James Tanner <[email protected]>
Copy link

sonarcloud bot commented Mar 18, 2024

raise ValidationError(_('Invalid filter: %s') % value)
raise ValidationError(_('Invalid filter: %s' % value))
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't feel correct to me. If I understand right, this will do the string interpolation before _() meaning that the fully interpolated string is what will land in the translation files.

@relrod
Copy link
Member

relrod commented Mar 18, 2024

I think the correct way to deal with the %(user)s thing is to make it %%(user)s:

In [1]: 'foo %(bar)s' % {'bar': "aa"}
Out[1]: 'foo aa'

In [2]: 'foo %%(bar)s' % {'bar': "aa"}
Out[2]: 'foo %(bar)s'

@AlanCoding
Copy link
Member

AlanCoding commented Mar 19, 2024

^ The problem is that this is test input mocking user input. The solution is that you don't ever format a string from a user. Before this DRF upgrade they didn't format the string passed into ValidationError, thus the problem. Due to the DRF change, DAB code can't safely pass in a string with user data like it is doing now.

Link encode/django-rest-framework#9295

@jctanner jctanner mentioned this pull request Mar 19, 2024
@jctanner jctanner closed this Mar 19, 2024
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.

3 participants