Problem/Motivation
I exported a plaintext file with the filename 'email.txt' but the exported file has a filename 'email.txt.plaintext'
Steps to reproduce
- Create an export display for a view.
- Set the filename to whatever.txt
- Save view.
- Run the export, file is saved as 'whatever.txt.plaintext'
Proposed resolution
I'm not sure what the best approach would be. The first thing that comes to mind is to change line 12 in PlaintextEncoder.php from
protected static $format = 'plaintext';
to
protected static $format = 'txt';
But i'd rather avoid this type of patch just in case some people already have code that expects the 'plaintext' extension.
Or just create a new encoder that extends the PlaintextEncoder class and override the format.
What is the best approach?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | plaintext_encoder-txt_filename_extension-3230705-04.patch | 867 bytes | johnnydarkko |
Issue fork plaintext_encoder-3230705
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
Comment #2
johnnydarkko commentedComment #3
alexdoma commented@johnnydarkko Can you create a patch?
Comment #4
johnnydarkko commentedHere's a patch that now allows me to export files as txt which appears to work fine when exporting to the public directory, but I can't for the life of me get the file to download correctly when exporting to the private directory. I get a file not found error, but the file is definitely getting exported into the private directory. Changing status to "Needs work" in hopes to get support from someone more familiar with the process.
Warning: the patch also changes the name of the extension from "plaintext" to "txt" so the option would have be selected again in the export configurations:

Comment #6
alexdoma commented@johnnydarkko Changes added to dev branch. Thank you!