[ACE-4030] Download as Zip action upon custom folder type Created: 29-Jun-15  Updated: 16-Oct-15

Status: Open
Project: Alfresco One Platform
Component/s: Document Library, Rules and Actions
Affects Version/s: 5.0.c Community, 5.0
Fix Version/s: 5.N

Type: Bug Priority: Major
Reporter: Pavel (Inactive) Assignee: Investigation Queue (Inactive)
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In out project we have a custom folder type, which is a child of cm:folder:

<type name="ef:folder">
  <title>Parent of all folders</title>
  <parent>cm:folder</parent>
  <mandatory-aspects>
    <aspect>ef:typed</aspect>
  </mandatory-aspects>
</type>

The problem is that when I press Download as Zip button for selected folder(s) I get empty zip file. It comes from startNode method of ZipDownloadExporter.java:

@Override
public void startNode(NodeRef nodeRef)
{
  this.currentName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
  path.push(new Pair<String, NodeRef>(currentName, nodeRef));
  if (ContentModel.TYPE_FOLDER.equals(nodeService.getType(nodeRef)))
  {
    String path = getPath() + PATH_SEPARATOR;
    ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);
    try
    {
      zipStream.putArchiveEntry(archiveEntry);
      zipStream.closeArchiveEntry();
    }
    catch (IOException e)
    {
      throw new ExporterException("Unexpected IOException adding folder entry", e);
    }
  }
}

Since custom folder has type ef:folder this check returns false:

if (ContentModel.TYPE_FOLDER.equals(nodeService.getType(nodeRef)))

and folder is not added to the zip.



 Comments   
Comment by Pavel (Inactive) [ 29-Jun-15 ]

The workaround is to check if a custom folder type is a child of cm:content using dictionaryService:

if (dictionaryService().isSubClass((nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))

But it includes many code manipulations and not very convenient.

The workaround is suggested here: http://stackoverflow.com/a/30937163/1252056

Comment by Kevin Roast [X] (Inactive) [ 29-Jun-15 ]

Pavel, I can confirm this is a bug thanks for reporting.

Generated at Tue Jul 07 05:24:05 BST 2020 using JIRA 7.6.3#76005-sha1:8a4e38d34af948780dbf52044e7aafb13a7cae58.