We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88ca0bb commit 0191ed4Copy full SHA for 0191ed4
packages/yasqe/src/sparql.ts
@@ -372,7 +372,13 @@ function normalizeUrl(url: string): string {
372
fullUrl += url;
373
} else {
374
// Relative path
375
- fullUrl += window.location.pathname + url;
+ let basePath = window.location.pathname;
376
+ // If pathname does not end with "/", treat it as a file and use its directory
377
+ if (!basePath.endsWith("/")) {
378
+ const lastSlashIndex = basePath.lastIndexOf("/");
379
+ basePath = lastSlashIndex >= 0 ? basePath.substring(0, lastSlashIndex + 1) : "/";
380
+ }
381
+ fullUrl += basePath + url;
382
}
383
return fullUrl;
384
0 commit comments