comunica / jQuery-Widget.js

🖼 A jQuery widget to query heterogeneous interfaces using Comunica SPARQL
http://query.linkeddatafragments.org/
MIT License
19 stars 34 forks source link

Comunica Web client doesn't escape whitespace in the URL #112

Closed phochste closed 2 years ago

phochste commented 2 years ago

Issue type:


Description:

In the comunica demo website one can contruct a SPARQL query and then bookmark, copy&paste .. the URL to another window/website/blog post. This browser URL does not contain the new lines in the SPARQL code. The bookmarked URL will not work without editing. E.g. a copy and pastes URL:

https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/solid-default/#datasources=https:%2F%2Fbellow2.ugent.be%2Ftest%2Fscholix%2Facademic.oup.com%2Finbox%2F&query=PREFIX as: <https:%2F%2Fwww.w3.org%2Fns%2Factivitystreams#>PREFIX scholix: <http:%2F%2Fwww.scholix.org%2F>SELECT ?subject ?pred ?objectWHERE { ?id a as:Announce ; %09%09 as:object ?x . ?x as:relationship ?pred ; as:subject ?subject ; as:object ?object .}


Environment:

Vivaldi | 5.2.2623.39 (Stable channel) (x86_64) macOS Version 10.15.7 (Build 19H1824)

Comunica 2.1.0

Crash log:

github-actions[bot] commented 2 years ago

Thanks for reporting!

rubensworks commented 2 years ago

This sounds like a good first issue for a new developer :-) PRs are welcome!

phochste commented 2 years ago

The code is correct:

https://github.com/comunica/jQuery-Widget.js/blob/master/src/ldf-client-url-state.js#L96

Looks like a Chromium bug where history.replaceState can't update URLs which contain uri encoded whitespace (these are replaced with decoded whitespace).

history.replaceState(null,null,'#test%20%0A%20') # this will remove the %0A in and translate %20 in space

Works in Safari and Firefox.

rubensworks commented 2 years ago

Could it be a problem in Vivaldi? Because I can't reproduce the problem in Chrome.

phochste commented 2 years ago

Indeed, I filed a bug report to them.