Server.js icon indicating copy to clipboard operation
Server.js copied to clipboard

Incorrect implementation of file:// protocol for datasources

Open joachimvh opened this issue 8 years ago • 1 comments

Currently, when setting up a datasource using the file:// protocol, the 'file:' part of the link gets stripped and the remainder gets used to find the file ( https://github.com/LinkedDataFragments/Server.js/blob/master/lib/datasources/Datasource.js#L148 )

The first two slashes should also be stripped, and besides that there are some additional considerations ( https://en.wikipedia.org/wiki/File_URI_scheme ). And yes, one of the issues is that it's different between UNIX and Windows 😛

Now we could also just not do that and use our 'own' file protocol (file:URI as it is now). The reason for this issue is one specific test that uses the file:// protocol: https://github.com/LinkedDataFragments/Server.js/blob/master/test/datasources/Datasource-test.js#L63 This test fails on Windows because the extracted path becomes //C:/my/path. On unix the extracted path is ///my/path which is not a problem for the path parser.

So either that test has to change or the interpretation of the file:// protocol

joachimvh avatar Oct 12 '17 07:10 joachimvh

This bug has existed for a while apparently, so the number of LDF users that run on Windows must be pretty low :-)

Let's look into this after the 3.0.0 release.

rubensworks avatar Oct 12 '17 08:10 rubensworks