Problem/Motivation

Trying to use the Node import via file fails because the code still uses the deprecated file_validate function.
https://www.drupal.org/node/3363700

Steps to reproduce

Upload an exported JSON at /admin/content/import/file gets the following error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_validate_extensions" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: Callback, Blank, NotBlank, Email, Choice, File, Image, PositiveOrZero, IdenticalTo, BlockContentEntityChanged, CKEditor5Element, CKEditor5MediaAndFilterSettingsInSync, CKEditor5EnabledConfigurablePlugins, CKEditor5FundamentalCompatibility, SourceEditingPreventSelfXssConstraint, SourceEditingRedundantTags, StyleSensibleElement, CKEditor5ToolbarItemConditionsMet, CKEditor5ToolbarItem, CKEditor5ToolbarItemDependencyConstraint, UniqueLabelInList, CommentName, DateTimeFormat, FileEncoding, FileExtension, FileExtensionSecure, FileImageDimensions, FileIsImage, FileNameLength, FileSizeLimit, FileUriUnique, FileValidation, LinkAccess, LinkExternalProtocols, LinkNotExistingInternal, LinkType, MenuTreeHierarchy, MenuSettings, PathAlias, TaxonomyHierarchy, ProtectedUserField, RoleExists, UserCancelMethod, UserMailRequired, UserMailUnique, UserName, UserNameUnique, ConfigExists, LangcodeRequiredIfTranslatableValues, RequiredConfigDependencies, Bundle, EntityChanged, EntityHasField, EntityType, EntityUntranslatableFields, ImmutableProperties, ReferenceAccess, ValidReference, ExtensionAvailable, ExtensionExists, ExtensionName, MenuLinkDepth, UniquePathAlias, ValidPath, PluginExists, AllowedValues, AtLeastOneOf, ClassResolver, ComplexData, Count, CountryCode, EntityBundleExists, FullyValidatable, Null, Length, MappingCollection, NotNull, Optional, PrimitiveType, Range, Regex, Required, Sequentially, Serialized, UniqueField, UriHost, Uuid, ValidKeys, ValidSequenceKeys in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /home/wwwuniae/arco/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Proposed resolution

Replace in /node_export/src/Form/NodeImportFile.php line 48 with
$validators = ['FileExtension' => ['extensions' => 'json']];

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

mtoscano created an issue. See original summary.

Anonymous’s picture

jernejmramor made their first commit to this issue’s fork.

Anonymous’s picture

Status: Active » Needs review

Hello,

I've investigated this issue and this happened because file_validate_extensions plugin got deprecated in 10.2 (Changelog for this deprecation : https://www.drupal.org/node/3363700). When testing the proposed solution I encountered on another error where $this was used in a static function in NodeImport service so I've resolved as well. Another thing I've noticed is that module still has compatibility with D9 which was EOL in 2023, so I would also suggest that this gets handled, but in an separate issue.

i-trokhanenko’s picture

Version: 8.x-1.4 » 8.x-1.x-dev
Status: Needs review » Reviewed & tested by the community
i-trokhanenko’s picture

Status: Reviewed & tested by the community » Fixed

Merged. Thanks!

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.