Skip to content

Commit 2861f58

Browse files
Add file scheme by default on memory sources
1 parent 6bdb7f4 commit 2861f58

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/core/lib/datasources/MemoryDatasource.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ class MemoryDatasource extends Datasource {
99
constructor(options) {
1010
let supportedFeatureList = ['quadPattern', 'triplePattern', 'limit', 'offset', 'totalCount'];
1111
super(options, supportedFeatureList);
12+
if (options.file) {
13+
if (!options.file.startsWith('file://') && !options.file.startsWith('http://') && !options.file.startsWith('https://'))
14+
options.file = `file://${options.file}`;
15+
}
16+
17+
this._url = options && (options.url || options.file);
1218
}
1319

1420
// Prepares the datasource for querying

packages/datasource-jsonld/lib/datasources/JsonLdDatasource.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ let ACCEPT = 'application/ld+json;q=1.0,application/json;q=0.7';
1010
class JsonLdDatasource extends MemoryDatasource {
1111
constructor(options) {
1212
super(options);
13-
this._url = options && (options.url || options.file);
1413
}
1514

1615
// Retrieves all quads from the document

0 commit comments

Comments
 (0)