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

Bug 525642

Summary: Trying to set file contents on a folder crashes server
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: NodeAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 15.0   
Target Milestone: 17.0   
Hardware: PC   
OS: Mac OS X   
See Also: https://github.com/eclipse/orion.client/pull/213
Whiteboard:

Description Michael Rennie CLA 2017-10-05 13:47:43 EDT
Consider the following unit test:

it('write file contents to directory', function(done) {
 request()
  .post(PREFIX + '/project')
  .type('json')
  .send({Name: 'testDir', Directory: true})
  .expect(201)
  .end(function(err, res) {
    testHelper.throwIfError(err);
    request()
      .put(res.body.Location)
      .send('directory contents')
      .expect(400)
      .end(function(err, res) {
        testHelper.throwIfError(err);
      });
    })
});

The result is the server barfs:

[2017-10-05 13:41:16.084] [ERROR] file - { Error: EISDIR: illegal operation on a directory, open '/Users/mrennie/git/orion.client/modules/orionode/test/support/.test_workspace/project/testDir/'
    at Error (native)
  errno: -21,
  code: 'EISDIR',
  syscall: 'open',
  path: '/Users/mrennie/git/orion.client/modules/orionode/test/support/.test_workspace/project/testDir/' }
Comment 1 Eclipse Genie CLA 2017-10-05 15:17:34 EDT
GitHub Pull Request 213 created by [mrennie]
https://github.com/eclipse/orion.client/pull/213
Comment 2 Michael Rennie CLA 2017-10-05 16:08:11 EDT
Merged.