pantheon-systems / documentation

Pantheon Docs
https://docs.pantheon.io
Other
194 stars 660 forks source link

Modules and Plugins with Known Issues - Additional issue for Contact form 7 #4487

Closed ruthiepantheon closed 5 years ago

ruthiepantheon commented 5 years ago

Re: Modules and Plugins with Known Issues

Priority: Medium

Issue Description:

Issue 2: This plugin has a file attachment field in it's settings which has some issues in the platform when specifying a file URL that is existing inside the wp-content/uploads folder. https://contactform7.com/file-uploading-and-attachment/

The wp-content/uploads folder in the platform is symlinked to the /files folder. This plugin’s file attachment field doesn’t seem to accept symlinked paths.

Related ticket: 126521 Related chat: 20808629438

Suggested Resolution

Move your file attachment anywhere inside the wp-content folder other than the uploads folder.

If you have this file wp-content/uploads/2019/01/attachment.pdf - this will not work since it’s inside the uploads folder.

You can move it to wp-content/attachment.pdf or wp-content/another-folder/attachment.pdf to make it work. No need to specify "wp-content" in the file attachment field since this field already expects the file to be inside the wp-content folder. So in the file attachment field, you can specify there "attachment.pdf" or "another-folder/attachment.pdf" directly.

Since the file attachment needs to be outside the wp-content/uploads folder, they may need to do this on dev first and commit the file there and then deploy to test and live. They can't do this on test and live since test and live are non-writable.

alexfornuto commented 5 years ago

@ruthiehallarsis I don't understand how committing into the codebase an attachment file that's not writable in Live will help users of the form upload their own files. Can you please clarify?

ruthiepantheon commented 5 years ago

Hey @alexfornuto the file attachments getting uploaded and sent by form submitters are okay and working well.

However, Contact Form 7 has this feature that can let admins of the site add a default file attachment that gets sent too along with the file attachments uploaded by form submitters. This default file attachment needs to be anywhere inside the wp-content folder. Admins need to specify the default file attachment path URL into the configuration page of the plugin.

The issue is, if the file is inside the wp-content/uploads folder, the plugins's config wont save and will have an error that the file doesnt exist, where in fact it does. But when i moved the file outside the uploads folder, it works and the default file gets submitted too.

Let me know if you need further explanation.

alexfornuto commented 5 years ago

Thanks for the additional context @ruthiehallarsis! I now understand the issue being presented.

In the docs you linked to, it provides an example with thte "Local File" living in uploads. As you pointed out, the plugin assumes a path starting wp-content, so I wonder if there's an issue there where we were testing the path as wp-content/uploads/ and not /uploads/.

Did you encounter this only on a customer's configuration, or did you verify on a sanitized test environment?

ruthiepantheon commented 5 years ago

Hi @alexfornuto, i've tested this out with a test site, and it's indeed happening to it too.

http://dev-wpcf7.pantheonsite.io/wp-admin/admin.php?page=wpcf7&post=5&action=edit

I uploaded attachment.txt to several places: wp-content/ , wp-content/plugins/, wp-content/uploads/.

These values doesn't work:

wp-content wp-content1 wp-content-uploads wp-content-uploads-1 uploads uploads-1 url-https url

But these values work and the form settings gets saved:

attachment plugins

i've tested this out too with another site that i have integrated with sendgrid so it will actually send the email with the attachment, and it worked on dev, test as well as live when the file is not inside the wp-content/uploads folder.

ruthiepantheon commented 5 years ago

Also, @carl-alberto just submitted an issue about this to the plugin developer:

https://wordpress.org/support/topic/local-file-attachments-do-not-work-in-pantheon-hosting/