Problem/Motivation

The attachments' urls in the email sent by the webform cause 404 error.
/system/files/webform/xxxxxxxxxxxx/14455/Objectifs%20de%20qualité%20++-+àèé!i.pdf
The url is not url_encoded.

The url works after being encoded manually.

Steps to reproduce

Create a webform
Add a file upload field
Configure the webform to send all values using :
{{ webform_token('[webform_submission:values]', webform_submission, [], options) }}
Submit the form with a file which as a filename with special characters.
Received the mail and test the attachment url.

Proposed resolution

Url_encoding attachment url.

I know that I can use the sanitize option in the file upload field but it's not the correct solution if sanitizment is not required.
I guess we should be able to reach unsanitize files using a url_encoded url.

Comments

paul_leclerc created an issue. See original summary.

jrockowitz’s picture

The error I am getting with that file name is

The filename fallback cannot contain the "%" character.

jrockowitz’s picture

Related issues: +#3339612: None ASCII characters file names
StatusFileSize
new1.03 KB

Please review the attached patch

jrockowitz’s picture

Status: Active » Needs review
jrockowitz’s picture

StatusFileSize
new1.77 KB

Here is a backport to 6.1.x

  • ec0adebb committed on 6.1.x
    Issue #3351042 by jrockowitz: Webform url attachment are not url_encode
    

  • ec0adebb committed on 6.x
    Issue #3351042 by jrockowitz: Webform url attachment are not url_encode
    
jrockowitz’s picture

Status: Needs review » Fixed

  • ec0adebb committed on 6.2.x
    Issue #3351042 by jrockowitz: Webform url attachment are not url_encode
    

Status: Fixed » Closed (fixed)

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