Skip to content

Commit

Permalink
Merge branch 'main' into query-to-update
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Utils.ts
  • Loading branch information
julianrojas87 committed Jun 25, 2024
2 parents 8a22cc2 + b6a89cc commit 7e331fb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ export async function doSPARQLRequest(query: string, url: string): Promise<void>
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
body: `update=${encodeURIComponent(query)}`
body: `update=${fixedEncodeURIComponent(query)}`
});

if (!res.ok) {
throw new Error(`HTTP request failed with code ${res.status} and message: \n${await res.text()}`);
}
}

function fixedEncodeURIComponent(str: string) {
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
return '%' + c.charCodeAt(0).toString(16);
});
}

0 comments on commit 7e331fb

Please sign in to comment.