Problem/Motivation

Inline files held in <a> tags that are uploaded into "Advanced HTML/Text" elements are stored in temporary mode, and can be deleted when cron runs.

Steps to reproduce

1. Create a webform with an "Advanced HTML/Text" element
2. Using a module such as Editor File Upload, upload a file into this element.
3. Examine the file in the database and see that it is marked as temporary.

If "Delete temporary files after" (/admin/config/media/file-system) is not set to "Never", the uploaded file may get deleted on a future cron run.

Proposed resolution

Broaden _webform_parse_file_uuids() to also look for linked files in <a> tags, not just inside <img> tags.

Remaining tasks

Patch, review.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chrisolof created an issue. See original summary.

chrisolof’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.05 KB

Patch attached. Changes _webform_parse_file_uuids() such that it also looks for files inside of <a> tags.

It was tempting to do exactly what _editor_parse_file_uuids() does, but unfortunately _webform_parse_file_uuids() isn't always given an HTML snippet. For instance, _webform_get_array_file_uuids() hands it YAML. As such I've also updated _webform_parse_file_uuids()'s documentation to reflect that it's designed to work with any sort of text string, not just an HTML snippet.

  • chrisolof authored 1a995c6 on 8.x-5.x
    Issue #3168051 by chrisolof: Inline files held in <a> tags are stored as...
jrockowitz’s picture

Status: Needs review » Fixed

  • chrisolof authored 1a995c6 on 6.x
    Issue #3168051 by chrisolof: Inline files held in <a> tags are stored as...

Status: Fixed » Closed (fixed)

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