Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348073

Summary: Attempt to download as zip on empty directory gives ugly message.
Product: [ECD] Orion Reporter: Mike Wilson <Mike_Wilson>
Component: ServerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: ahunter.eclipse, Szymon.Brandys
Version: 0.2Keywords: polish
Target Milestone: 3.0 RC2Flags: john.arthorne: review+
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Fix v01
none
A sample fix for client.core
none
Empty zip file none

Description Mike Wilson CLA 2011-06-02 10:48:49 EDT
Steps to reproduce:

1) Create a new folder at the root.
2) Click "download as zip" button beside the folder

Result: 404 page 
"
  HTTP ERROR 404

  Problem accessing /xfer/export/a.zip. Reason:

      The folder is empty
  Powered by Jetty://
"
Comment 1 John Arthorne CLA 2011-06-08 14:37:25 EDT
Created attachment 197628 [details]
Fix v01

Zips can't be empty, so this fix just avoids adding the "export" link for empty directories.
Comment 2 John Arthorne CLA 2011-06-09 13:56:02 EDT
Ping, Szymon can you review.
Comment 3 Szymon Brandys CLA 2011-06-10 06:56:12 EDT
If I add a file to an empty folder, the export icon will not show up. The same if we delete all folder content, the export icon remains and clicking it will end up with 404.

We either need extra UI changes, see the attachment with refreshing during create and deleting file/folder. But we should add similar code to import, copy/move operations probably too. The code is not optimal though. Or we could return an empty zip file. I was able to create one, we could keep in on the server side and return if a folder to export is empty :)
Comment 4 Szymon Brandys CLA 2011-06-10 06:58:07 EDT
Created attachment 197762 [details]
A sample fix for client.core
Comment 5 Szymon Brandys CLA 2011-06-10 06:58:29 EDT
Created attachment 197763 [details]
Empty zip file
Comment 6 Szymon Brandys CLA 2011-06-10 07:12:06 EDT
I checked that for Move and Copy operations the tree is refreshed and the Export icon shows up when we copy/move something to an empty folder. However I was not able to check what happens for Import operations. Zip import seems to be partially broken i.e. stuff is imported, but the tree is not refreshed. John do you see this too?
Comment 7 John Arthorne CLA 2011-06-10 10:03:13 EDT
Deferring. This is becoming too complicated for a cosmetic fix. There is no value in downloading an empty folder as a zip. The 404 page isn't pretty but we can live with it for 0.2.

Note I think your client changes make sense anyway. When adding/deleting a file the parent should be refreshed, otherwise the cached item in the client has an incorrect Children entry. Your patch should be revisited posted 0.2 (shouldn't need to refresh both parent and child though).
Comment 8 Mike Wilson CLA 2011-06-10 16:31:22 EDT
(In reply to comment #7)
> Deferring. This is becoming too complicated for a cosmetic fix. There is no
> value in downloading an empty folder as a zip. The 404 page isn't pretty but we
> can live with it for 0.2.
> 
To be clear: I wasn't requesting that we fix this for 0.2, just capturing the bug so we wouldn't lose it.
Comment 9 Anthony Hunter CLA 2013-06-10 14:51:10 EDT
(In reply to comment #1)
> Created attachment 197628 [details]
> Fix v01
> 
> Zips can't be empty, so this fix just avoids adding the "export" link for
> empty directories.

This fix from John solved the original issue that Mike reported. I would suggest we simply deliver to resolve the original issue as reported.

I have updated the change at:

https://github.com/ahunter-orion/orion.server/commit/043d3c78a51ac2271fb8115ce268b8d4707827ce

I assert that John authored 100% of the content of this contribution and I have the rights to donate the content again to Eclipse under the EPL since I just updated for the latest Orion bits.