You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to save a dataset with an upload_or_link url fails with the error
This is the result of this line in Drupal Core's FormValidator.php
if (isset($elements['#maxlength']) && mb_strlen($elements['#value']) > $elements['#maxlength']) {
$form_state->setError($elements, $this->t('@name cannot be longer than %max characters but is currently %length characters long.', ['@name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => mb_strlen($elements['#value'])]));
}
If the maxlength is set, it will automatically try to validate the string.
It came from this commit
which introduced a default maxlength for many things. I believe the It was missed that upload_or_link should not have a maxlength applied (because it has multiple elements in an array).
Ultimately it is tied to a Drupal core bug
but that solution may be a ways off.
For now we should follow the existing pattern of
// If a maxlength was set earlier, remove it as it is not allowed here.
unset($element['#maxlength']);
Expected Behavior
Datasets save without error if they have a upload_or_link value supplied
Steps To Reproduce
create a new dataset with a url for the upload
save the dataset
see error about mb_strlen being unhappy with being fed an array.
Relevant log output (optional)
-
Anything else?
The text was updated successfully, but these errors were encountered:
Current Behavior
Trying to save a dataset with an upload_or_link url fails with the error
This is the result of this line in Drupal Core's FormValidator.php
If the maxlength is set, it will automatically try to validate the string.
It came from this commit
which introduced a default maxlength for many things. I believe the It was missed that upload_or_link should not have a maxlength applied (because it has multiple elements in an array).
Ultimately it is tied to a Drupal core bug
but that solution may be a ways off.
For now we should follow the existing pattern of
Expected Behavior
Datasets save without error if they have a upload_or_link value supplied
Steps To Reproduce
Relevant log output (optional)
Anything else?
The text was updated successfully, but these errors were encountered: