Currently, if a file to be included in an archive is stored in a sub directory off its public:// or private:// schema, that directory structure is not maintained in the resulting zip archive. (Note that you can specify an optional sub directory under the "File directory" form input when editing a field of type File.) Instead, all selected files will be included in the root directory of the zip archive and filenames changed to prevent duplicates.

A desired feature is to preserve this subdirectory structure in the resulting archive.

I have created a patch to accomplish this.

This patch has two components:

1. New "Operation Settings" for the archive action: Add a field to "Maintain file directory structure". The default is unchecked, preserving the existing behavior by default.

2. Modified archive creation functionality to maintain the file directory structure based on the specified operation setting.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rhankins created an issue. See original summary.

rhankins’s picture

rhankins’s picture

Assigned: rhankins » Unassigned
joelpittet’s picture

Status: Active » Needs work

Thanks for the patch, there looks to be a lot of coding standard fixes needed, I'll let you review or setup PHP CodeSniffer to fix these.

https://drupal.org/coding-standards
https://www.drupal.org/node/1419988

rhankins’s picture

Okay, joelpittet, so looks like my original patch file basically included the whole file as changed, even though I just patched a few lines. I think this was probably due to an endline issue I had in there.

At any rate, I went ahead and used CodeSniffer to fix the whole file which had a number of legacy coding standard issues.

So, those fixes, along with the few lines of my original patch are in the newly attached patch. Please advise.

Thanks!

joelpittet’s picture

Status: Needs work » Needs review

That looks much better and 1/4 the size, thanks @rhankins! Let's see what others using this functionality say once they test it out.