Problem/Motivation
File validation changed in Drupal 11. This module in its current form is not compatible with Drupal 11.
https://www.drupal.org/docs/drupal-apis/entity-api/entity-validation-api...
Steps to reproduce
- Enable the module
- Attempt to upload a file that already exists on the file system and you will get the following error message in Drupal 11.1:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_temporary_validator_validate" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: Callback, Blank, NotBlank, Email, Choice, Image, AddressFormat, Country, BlockContentEntityChanged, CKEditor5ToolbarItemDependencyConstraint, CKEditor5Element, UniqueLabelInList, StyleSensibleElement, CKEditor5MediaAndFilterSettingsInSync, CKEditor5ToolbarItemConditionsMet, CKEditor5EnabledConfigurablePlugins, SourceEditingPreventSelfXssConstraint, CKEditor5FundamentalCompatibility, CKEditor5ToolbarItem, SourceEditingRedundantTags, CommentName, ModerationState, CropTypeMachineNameValidation, CropTypeAspectRatioValidation, DateTimeFormat, EntityBrowserImageDimensions, QueueSize, FileSizeLimit, FileNameLength, FileEncoding, FileUriUnique, FileExtensionSecure, FileExtension, FileValidation, FileImageDimensions, FileIsImage, LinkExternalProtocols, LinkType, LinkAccess, LinkNotExistingInternal, MediaMappingsConstraint, oembed_resource, MenuSettings, PathAlias, RedirectSourceLinkType, SchedulerPublishOn, SchedulerUnpublishOn, SchedulerModeration, SchedulerUnPublishState, SchedulerPublishState, TaxonomyHierarchy, Ip, ProtectedUserField, UserName, UserCancelMethod, UserMailRequired, UserMailUnique, UserNameUnique, UsptoFilename, VideoEmbedValidation, MenuTreeHierarchy, PluginExists, EntityUntranslatableFields, ImmutableProperties, EntityHasField, Bundle, ValidReference, ReferenceAccess, EntityChanged, EntityType, ConfigExists, RequiredConfigDependencies, LangcodeRequiredIfTranslatableValues, ValidKeys, FullyValidatable, AllowedValues, Range, UniqueField, Uuid, CountryCode, UriHost, Length, Regex, Null, EntityBundleExists, PrimitiveType, ComplexData, Count, NotNull, ExtensionExists, ExtensionName, UniquePathAlias, ValidPath in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /var/www/html/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Proposed resolution
Code needs to be updated for Drupal 11
Remaining tasks
Convert #upload_validators to Drupal 11 compatible code.
User interface changes
None
API changes
Data model changes
Issue fork file_temporary_validator-3526881
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
Comment #2
j-barnes commentedComment #4
j-barnes commented@pmagunia - thanks for reporting this. I've added a new constraint that should now be used on 10.2+ for validation. Going to try and write up some tests for this before getting it in.
Comment #5
j-barnes commentedEnabled Gitlab CI and added some basic functional tests to validate the functionality.
Comment #6
j-barnes commentedComment #8
j-barnes commentedComment #9
j-barnes commentedComment #10
jmaguniaYou’re very welcome. Wow you fixed this pretty fast. Will try out when I get a chance.
Comment #11
sunny-lee commentedLooks good here! Tested on Drupal 10.4.6 for several content types and the validator is working if the same file name is being uploaded at the same time.
Comment #12
j-barnes commented