Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344061 - [client] "delete folder" on linked folder deletes underlying data
Summary: [client] "delete folder" on linked folder deletes underlying data
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: 0.2   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-27 19:34 EDT by Susan McCourt CLA
Modified: 2011-09-01 11:42 EDT (History)
2 users (show)

See Also:


Attachments
Fix v01 (793 bytes, patch)
2011-04-29 09:50 EDT, John Arthorne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2011-04-27 19:34:21 EDT
I've always been a little nervous about deleting a linked file.
Today I finally tried it. 
My expectation was that it deletes the folder from the workspace, but does not delete the data linked in the file system (or that it would prompt what to do with the data in the file system).

But that's not what happens. It is completely broken.

- it deletes the underlying data (!!!!)
- it doesn't remove the folder from the workspace list
- now I have a folder linking to my data, but it 404s because the data is no longer there.

(the only reason I'm not marking this "critical" is that it's only a self hosting scenario, not an orionhub scenario).
Comment 1 Susan McCourt CLA 2011-04-27 19:35:44 EDT
John, I marked this [client] but I'm really not sure where the fix goes.  

It seems like either fileClient or the server should handle this case.  I can't imagine that the UI would have to check whether something is a linked folder before asking fileClient to delete it.
Comment 2 John Arthorne CLA 2011-04-28 10:55:50 EDT
From the server API you can delete either the contents or just remove the folder from the workspace without deleting anything. It depends which URL you call the DELETE operation on. I'll take a look to see where the problem is.
Comment 3 John Arthorne CLA 2011-04-29 09:48:28 EDT
This was broken by the multi-file client changes and I think we have to fix it. The deleteProject function in the file client isn't even being called at the moment. This means the *content* of the project gets deleted, but the project itself is not deleted. Once in this state you get 404 errors every time in the top level navigator loads, because projects are expected to exist but their content is missing. There is no way to delete a project at the moment.

The problem is this code in fileCommands.js:

if (item.parent.Path === "") {
  fileClient.removeProject(...);
} else {
  fileClient.deleteFile(...);
}

The parent of a project used to be "", but now it is "/file/". So the else clause is always executed, even for a project.
Comment 4 John Arthorne CLA 2011-04-29 09:50:52 EDT
Created attachment 194357 [details]
Fix v01