Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDirectoryContents returning different and broken result on Windows #101

Closed
julijane opened this issue Sep 10, 2018 · 2 comments · Fixed by #102
Closed

getDirectoryContents returning different and broken result on Windows #101

julijane opened this issue Sep 10, 2018 · 2 comments · Fixed by #102

Comments

@julijane
Copy link
Contributor

julijane commented Sep 10, 2018

The result of getDirectoryContents is broken on Windows.

Sample code:

var webdavClient = require('webdav')
var webdav = webdavClient(
    'https://<redacted>',
    'test',
    '<redacted>'
)
webdav.getDirectoryContents('/test').then(function(contents){
    console.log(contents)
})

Result on Linux:

[ { filename: '/test/testfile',
    basename: 'testfile',
    lastmod: 'Mon, 10 Sep 2018 23:43:40 GMT',
    size: 0,
    type: 'file',
    mime: 'application/octet-stream' },
  { filename: '/test/testfile2',
    basename: 'testfile2',
    lastmod: 'Mon, 10 Sep 2018 23:43:44 GMT',
    size: 0,
    type: 'file',
    mime: 'application/octet-stream' } ]

Result on Windows:

[ { filename: '/test',
    basename: 'test',
    lastmod: 'Mon, 10 Sep 2018 23:43:46 GMT',
    size: 0,
    type: 'directory' },
  { filename: '/test\\testfile',
    basename: 'testfile',
    lastmod: 'Mon, 10 Sep 2018 23:43:40 GMT',
    size: 0,
    type: 'file',
    mime: 'application/octet-stream' },
  { filename: '/test\\testfile2',
    basename: 'testfile2',
    lastmod: 'Mon, 10 Sep 2018 23:43:44 GMT',
    size: 0,
    type: 'file',
    mime: 'application/octet-stream' } ]

So on Windows the full filename is wrong and (partly) using windows path separators, also the containing directory is included in the output on Windows.

This is with webdav 1.5.3 from npm.

@julijane
Copy link
Contributor Author

Turns out this is easily fixed. I submitted a PR.

@perry-mitchell
Copy link
Owner

@julijane Thanks! Pathing has really been a huge pain.. Nice that you got it fixed so quickly. I'll merge and release asap.

perry-mitchell added a commit that referenced this issue Sep 11, 2018
Fix for getDirectoryContents on Windows (Fixes issue #101)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants