Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Validator] AddfilenameCharset
andfilenameCountUnit
options toFile
constraint#58485
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please add a testcase to avoid further regression
nicolas-grekas commentedOct 8, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm 👎 here: the length in bytes is what matters. Eg a storage can have a 255-max string field counted in bytes, and this validator guards against longer filenames. Validating in code points makes it really hard to validate any predictable maxlength. Also, nothing tells this accepts only UTF-8 (it doesn't, bytes are bytes, no encoding expected here). |
IssamRaouf commentedOct 8, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hello@nicolas-grekas For the context of thefilenameMaxLength constraint option, from its name alone, it clearly suggests a validation onthe string's length. let's take this example :
#[Assert\File( Result: I find this contradictory 😅. |
Hello@OskarStark ok, I'm waiting for the issue to be validated |
We could make this opt-in, eg with a countUnit and a charset option (names taken from the Length constraint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, here are some minor last changes.
Please also rebase to target 7.3 since this is a new feature.
And move the changelog lines in the 7.3 section.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
filenameCharset
andfilenameCountUnit
options toFile
constraintUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
$payload, | ||
$filenameCharset, | ||
$filenameCountUnit, | ||
$filenameCharsetMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
$filenameCharsetMessage | |
$filenameCharsetMessage, |
…`File` constraint
Thank you@IssamRaouf. |
46e00d5
intosymfony:7.3Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.