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

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

pmagunia created an issue. See original summary.

j-barnes’s picture

Assigned: Unassigned » j-barnes

j-barnes’s picture

@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.

j-barnes’s picture

Enabled Gitlab CI and added some basic functional tests to validate the functionality.

j-barnes’s picture

Status: Active » Needs review

  • j-barnes committed fb7029f7 on 1.0.x
    Issue #3526881 by j-barnes, pmagunia: Not compatible with Drupal 11
    
j-barnes’s picture

j-barnes’s picture

Status: Needs review » Fixed
jmagunia’s picture

You’re very welcome. Wow you fixed this pretty fast. Will try out when I get a chance.

sunny-lee’s picture

Status: Fixed » Reviewed & tested by the community

Looks 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.

j-barnes’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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