Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348073 - Attempt to download as zip on empty directory gives ugly message.
Summary: Attempt to download as zip on empty directory gives ugly message.
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Server (show other bugs)
Version: 0.2   Edit
Hardware: PC Mac OS X
: P3 minor (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2011-06-02 10:48 EDT by Mike Wilson CLA
Modified: 2013-06-12 14:26 EDT (History)
2 users (show)

See Also:
john.arthorne: review+


Attachments
Fix v01 (2.38 KB, patch)
2011-06-08 14:37 EDT, John Arthorne CLA
no flags Details | Diff
A sample fix for client.core (1.60 KB, text/plain)
2011-06-10 06:58 EDT, Szymon Brandys CLA
no flags Details
Empty zip file (22 bytes, application/octet-stream)
2011-06-10 06:58 EDT, Szymon Brandys CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.