Skip to content

Commit d3d874e

Browse files
committed
Fix SPARQL escape URI and string helpers
Apply regex with global flag to escape all occurrenses instead of only the first one.
1 parent e2f3713 commit d3d874e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

helpers/mu/sparql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ function query( queryString ) {
7373
const update = query;
7474

7575
function sparqlEscapeString( value ){
76-
return '"' + value.replace(/[\\"']/, function(match) { return '\\' + match; }) + '"';
76+
return '"' + value.replace(/[\\"']/g, function(match) { return '\\' + match; }) + '"';
7777
};
7878

7979
function sparqlEscapeUri( value ){
80-
return '<' + value.replace(/[\\"']/, function(match) { return '\\' + match; }) + '>';
80+
return '<' + value.replace(/[\\"']/g, function(match) { return '\\' + match; }) + '>';
8181
};
8282

8383
function sparqlEscapeInt( value ){

0 commit comments

Comments
 (0)