Skip to content

Commit

Permalink
Add file scheme by default on memory sources
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelomachado authored Oct 31, 2022
1 parent 6bdb7f4 commit 2861f58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/core/lib/datasources/MemoryDatasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class MemoryDatasource extends Datasource {
constructor(options) {
let supportedFeatureList = ['quadPattern', 'triplePattern', 'limit', 'offset', 'totalCount'];
super(options, supportedFeatureList);
if (options.file) {
if (!options.file.startsWith('file://') && !options.file.startsWith('http://') && !options.file.startsWith('https://'))
options.file = `file://${options.file}`;
}

this._url = options && (options.url || options.file);
}

// Prepares the datasource for querying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let ACCEPT = 'application/ld+json;q=1.0,application/json;q=0.7';
class JsonLdDatasource extends MemoryDatasource {
constructor(options) {
super(options);
this._url = options && (options.url || options.file);
}

// Retrieves all quads from the document
Expand Down

0 comments on commit 2861f58

Please sign in to comment.