Skip to content

Secretary doesn't comply to URL syntax specification #91

@piotr-yuxuan

Description

@piotr-yuxuan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions