Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secretary doesn't comply to URL syntax specification #91

Open
piotr-yuxuan opened this issue Jan 12, 2017 · 2 comments
Open

Secretary doesn't comply to URL syntax specification #91

piotr-yuxuan opened this issue Jan 12, 2017 · 2 comments

Comments

@piotr-yuxuan
Copy link
Contributor

piotr-yuxuan commented Jan 12, 2017

Hiya there,

First of all, thank you very much for that piece of free software :-) I've been using happily for a long time and it works well expect for this edge case which has been rather painful for me. To the best of my knowledge there is no issue about this so I fill this one just to reference this behaviour.

According to Wikipedia (and explained in a very circumlocutory way on https://url.spec.whatwg.org/) the syntax of a URL is :

scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]

However, when secretary is used without html5 routing the in-app route is stored in the fragment and then the query part is added. Reasons for this are obvious (legibility) but resulting URL respect no longer the syntax. Instead, they use this custom syntax:

scheme:[//[user:password@]host[:port]][/]path[#fragment][?query]

Using this custom syntax will cause Secretary and Standard libraries to firmly disagree on some painful edge cases, e.g. :

https://www.example.com/path/of/app#path/inside/app?query=params&as=defined&by=secretary
  • fragment: "path/inside/app?query=params&as=defined&by=secretary" for standard libraries but should be "path/inside/app" according to Secretary
  • query: "" but should be "query=params&as=defined&by=secretary" according to Secretary

Of course, a very naive regex will get us data we need:

(def hash-according-to-secretary-syntax
  (comp second (partial re-find #"\#([^?]*)"))

I just wonder if you could add tiny functions somewhere in a utility namespace to allow Secretary's users to access fragment and query as meant by the custom syntax used. If you agree with this but don't have much time to spare on this detail, just give me general directions about where / how put new code and I'll be happy to do that.

@gf3
Copy link
Collaborator

gf3 commented Jan 13, 2017

this certainly makes sense to me; unfortunately i definitely don't have time to address something like this anytime soon

@piotr-yuxuan
Copy link
Contributor Author

piotr-yuxuan commented Jan 13, 2017

Yeah, we all have either ideas but no time or time but no ideas ^^ I would happen to have not much time and even fewer ideas but I'd be glad to give it a try and see if I can contribute on that.

However I think it's enough to merely add some words about that in the readme. I issued a pull request for that.

(by the way #84 was about the same behaviour).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants