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

  1. Create an export display for a view.
  2. Set the filename to whatever.txt
  3. Save view.
  4. 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?

Command icon 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

johnnydarkko created an issue. See original summary.

johnnydarkko’s picture

Issue summary: View changes
alexdoma’s picture

@johnnydarkko Can you create a patch?

johnnydarkko’s picture

Status: Active » Needs work
StatusFileSize
new867 bytes
new46.43 KB

Here'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:
txt selection

alexdoma’s picture

Status: Needs work » Fixed

@johnnydarkko Changes added to dev branch. Thank you!

Status: Fixed » Closed (fixed)

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