Problem/Motivation

While trying to upload an svg image From the media tab i found this error in drupal 11
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_validate_extensions" plugin does not exist

Error message

Uploading svgs from the content forms works perfectly but here it does not

Steps to reproduce

uploading an svg image from this path returns that error
/media/add/vector_image

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

chihab created an issue. See original summary.

sarwan_verma’s picture

Status: Active » Needs review
StatusFileSize
new578 bytes

Hi,
I have resolved the 'Error uploading SVG' issue and attached a patch.
Please review and verify it.
Thank you!

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

kevinquillen’s picture

Version: 2.3.3 » 2.3.x-dev
StatusFileSize
new670 bytes

Updated patch, removes newline.

Without the change(s) the module version is not usable in Drupal 11.

thomaswalther’s picture

I try manually deleting this line. And the error still exists. I did drush cr after.
Maybe it do not work after an installation.

I will try tomorrow again with the fix before enabling.

kevinquillen’s picture

Did you try the dev branch?

jwilson3’s picture

Status: Needs review » Needs work

As was pointed out in #3489364: PluginNotFoundException: The "svg_image_field_validate_mime_type" plugin does not exist, a similar issue was reported for the Webform module #3409599: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "webform_file_validate_extensions" plugin does not exist.

This problem (I believe) is related to core Change Record #3363700: file_validate and related functions are deprecated and replaced with file.validator service and Constraint plugins.

My quick assessment here (similar to DamienMcKenna's follow-up issue on the webform queue) is that we should replace the file validation logic with a new Constraint plugin, instead of simply deleting the #file_validator from the codebase.

jwilson3’s picture

I would also point out that we had a similar issue that was intended to bring about backward compatibility to the #file_validator functionality in #3440077: Support new upload validator syntax from D10.2+, so it may make sense to implement a similar approach here, to add in the Drupal 11 compatibility.

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

jwilson3’s picture

It looks like the remaining failures are unrelated to the immediate fix here, but do have to do with Drupal 11 compatibility, code-sniffs, and deprecations.

@Taran2L If you're interested to keep pushing through, it would be fine to pull off the other "gitlab ci build failures for D11" to a separate issue for separate credits. Up to you.

taran2l’s picture

hi @jwilson3

this pipeline shows that it works now with D11 -> https://git.drupalcode.org/issue/svg_image_field-3482121/-/pipelines/403938

I'm removing gitlab CI staff from this one, as there is another one for that already #3501734: Drupal 11 compatibility fixes

taran2l changed the visibility of the branch 3482121-error-uploading-svg to hidden.

taran2l’s picture

Title: Error uploading svg from the media tab » Error uploading svg from the media tab (The "file_validate_extensions" plugin does not exist)
taran2l’s picture

Status: Needs work » Needs review
jwilson3’s picture

Assigned: Unassigned » jwilson3

I've just merged #3501734: Drupal 11 compatibility fixes. Will rebase...

jwilson3’s picture

  • jwilson3 committed b2fd7d75 on 2.3.x authored by taran2l
    Issue #3482121 by taran2l, jwilson3, kevinquillen, sarwan_verma: Error...
jwilson3’s picture

Status: Needs review » Fixed
Related issues: +#3501879: Drupal 11.2.x compatibility

Thanks folks for helping with the fix here.

With this issue fixed, I believe the module should now be fully compatible with Drupal 11.

While working on this issue, I noticed some deprecation warnings related to views integration for bleeding 11.2.x branch (release date scheduled for June 2025).

I've created a follow-up: #3501879: Drupal 11.2.x compatibility

  • jwilson3 committed 86f61312 on 2.3.x
    Issue #3482121 by jwilson3: correct string parameters for...
taran2l’s picture

thanks for the fast turnaround!

jwilson3’s picture

👍

This critical Drupal 11 compatibility issue has been included in the latest SVG Image Field module release 2.3.4

Note we still have a follow-up issue pending to get the new constraint validator (the fix introduced here) working on the modal forms:

#3501882: Use Constraint Validator on SVG upload in Media Library modal form

Status: Fixed » Closed (fixed)

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