Problem/Motivation

"file_validate_size" is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0.

When trying to upload a file via the Media directories UI, the following error is thrown:

The "file_validate_size" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: Callback, Blank, NotBlank, Email, Choice, Image, CKEditor5MediaAndFilterSettingsInSync, SourceEditingPreventSelfXssConstraint, CKEditor5ToolbarItem, CKEditor5FundamentalCompatibility, CKEditor5ToolbarItemDependencyConstraint, SourceEditingRedundantTags, UniqueLabelInList, CKEditor5EnabledConfigurablePlugins, StyleSensibleElement, CKEditor5Element, CKEditor5ToolbarItemConditionsMet, ModerationState, CropTypeMachineNameValidation, CropTypeAspectRatioValidation, DateTimeFormat, EntityBrowserImageDimensions, FileSizeLimit, FileNameLength, FileImageDimensions, FileValidation, FileExtension, FileIsImage, FileEncoding, FileUriUnique, FileExtensionSecure, LinkNotExistingInternal, LinkAccess, LinkExternalProtocols, LinkType, MediaMappingsConstraint, oembed_resource, MenuTreeHierarchy, MenuSettings, PathAlias, RedirectSourceLinkType, SchedulerPublishOn, SchedulerUnpublishOn, SchedulerUnPublishState, SchedulerModerationTransitionAccess, SchedulerPublishState, TaxonomyHierarchy, ValidAutoPurgePeriod, UserMailUnique, UserCancelMethod, UserName, UserMailRequired, ProtectedUserField, UserNameUnique, ContentTranslationSynchronizedFields, ExtensionExists, ExtensionName, ConfigExists, RequiredConfigDependencies, LangcodeRequiredIfTranslatableValues, ImmutableProperties, EntityType, ValidReference, EntityChanged, ReferenceAccess, EntityUntranslatableFields, Bundle, EntityHasField, UniquePathAlias, ValidPath, PluginExists, UriHost, Range, AllowedValues, FullyValidatable, PrimitiveType, CountryCode, Null, Length, UniqueField, ComplexData, Regex, Count, ValidKeys, Uuid, NotNull, EntityBundleExist

Steps to reproduce

  • Enable the media directory UI
  • Go to /admin/content/browser
  • Add a media with a file upload input, eg: image
  • Choose file and see the error trigger after trying to upload the file

Proposed resolution

  • Replace "file_validate_size" with the "FileSizeLimit" constraint.

Remaining tasks

  • Update validator plugin

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

laurielim created an issue. See original summary.

laurielim’s picture

Title: Drupal The "file_validate_size" plugin does not exist » The "file_validate_size" plugin does not exist

I'll post a MR shortly

laurielim’s picture

Assigned: laurielim » Unassigned
Issue summary: View changes
Status: Active » Needs review
ytsurk’s picture

Thank you for the error report and suggestions to fix the issue.

ytsurk’s picture

  • ytsurk committed a4ac73c3 on 2.2.x authored by laurielim
    Issue #3505101: The "file_validate_size" plugin does not exist
    
ytsurk’s picture

Status: Needs review » Fixed

Targeting further file validation api changes here #3505416: Respecting file validator API

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.