quasar icon indicating copy to clipboard operation
quasar copied to clipboard

[Bug] OpenURL utility ignores hash when setting relative url

Open Lou-Der opened this issue 8 years ago • 4 comments

If router is in hash mode and you call openURL with a relative path it sets the path without the"/#" prefix.

Problem: To get the correct path in hash mode you would have to prefix all of your entries with a hardcoded "/#/path". If at a later date you switch to history mode you would need to adjust all of the openURL calls.

Suggested fix:
Pay attention to the vueRouterMode setting in the build config and auto prefix relative urls with the hash as necessary. To make it a non-breaking change I'd also check if its already being passed in.

Thanks!

Lou-Der avatar Apr 12 '18 20:04 Lou-Der

Can you please create a PR for this?

pdanpdan avatar Apr 12 '18 20:04 pdanpdan

I could try, never done a PR before :) Not sure how long it will take me to read up on how to proceed...

One issue with me doing this is I do not have a cordova testing environment and don't know how it would affect that section of the open-url.js code. Does cordova even use router hash mode?

Lou-Der avatar Apr 13 '18 20:04 Lou-Der

@pdanpdan

I've currently worked around the issue for my project but I'd be happy to make the adjustment I've suggested if you want me to proceed.

Before I create a PR, could you tell me if I should include Cordova in the router hash adjustments? I do not have a way to test it nor understand how it uses history.

Thanks

Lou-Der avatar Apr 25 '18 20:04 Lou-Der

Hi,

Closing this. openURL() is by no means required to keep account of the window's hash location. The main idea is for you to supply a full URL. So do just that. Make use of window.location.hash when you create those URLs.

rstoenescu avatar May 21 '18 19:05 rstoenescu