Problem/Motivation

We want to block POST requests to our site when the encoding is set to multipart/form-data however the Webform module sets the encoding for all forms it controls to this value. Now that Drupal can dynamically add the multipart/form-data encoding to forms that require it there is no reason for Webforms to hardcode this value.

Proposed resolution

Remove the hardcoded encoding type from Webform module.

$form['#attributes']['enctype'] = 'multipart/form-data';

Remaining tasks

Needs review by the community.

User interface changes

None.

API changes

None.

Data model changes

None.

Original report by [username]

None.

CommentFileSizeAuthor
webform-remove-enctype.patch658 bytesben.bunk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ben.bunk created an issue. See original summary.

DanChadwick’s picture

Category: Bug report » Feature request
quicksketch’s picture

Seems reasonable to me. We'll need to confirm this doesn't break anything, in particular file uploads which apparently set this attribute set automatically now. If we don't have test coverage on this yet, it'd also be good to confirm.

afi13’s picture

Status: Active » Needs review
snehi’s picture

+1 for RTBC, paased the test without breaking anything.
@ben.bunk thanks.

  • DanChadwick committed 4a287a5 on 7.x-4.x
    Issue #2614384 by ben.bunk: Added let Drupal determine enctype of a form...
DanChadwick’s picture

Status: Needs review » Fixed

Tested. Seems to work (you get the enctype if you include a file component and not otherwise).

Committed to 7.x-4.x. Thanks, folks.

DanChadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Category: Feature request » Task
Status: Fixed » Patch (to be ported)
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Category: Task » Feature request
Status: Patch (to be ported) » Fixed

Closing to clear out the old Webform 8.x-4.x branch. See #2827845: [roadmap] YAML Form 8.x-1.x to Webform 8.x-5.x.

  • DanChadwick committed 4a287a5 on 8.x-5.x
    Issue #2614384 by ben.bunk: Added let Drupal determine enctype of a form...

Status: Fixed » Closed (fixed)

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