Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat: $location.seach() should support semicolon (;) as an alternative delimiter to (ampersand) & #6140

Open
IgorMinar opened this issue Feb 5, 2014 · 2 comments

Comments

@IgorMinar
Copy link
Contributor

per RFC $location should parse both of these as equivalent

https://myapp/some/path/?show=all&ascending=true&sortField=id
https://myapp/some/path/?show=all;ascending=true;sortField=id

since we also need to be able to serialize the params with some separator, we should make the separator configurable (with & being the default)

@IgorMinar IgorMinar added this to the 1.3.x milestone Feb 5, 2014
@caitp
Copy link
Contributor

caitp commented Feb 7, 2014

What happens if you have a URL like https://myapp/some/path/?show=all&ascending=true;sortField=id ? Looking at the recommendation, it looks like this could cause problems when entity references are used. Seems like you'd have to have some way of figuring out which delimiter is correct, in the case that they're both used.

I've written a naive implementation which just splits by both & and ;, but as stated, I see some problems with that approach.

I guess hopefully, you don't end up with weird urls like that

caitp added a commit to caitp/angular.js that referenced this issue Feb 7, 2014
In accordance with recomendation in http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2, the
query parameters should support encoding and decoding using & or ; as a delimiter.

Angular will consistently encode search queries using either '&' or ';' as the delimiter, with '&' being the default.
This can be configured like so:

```js
$locationProvider.queryDelimiter(';'); // any other value will be treated as '&'
```

Closes angular#6140
@Rob89
Copy link

Rob89 commented Feb 12, 2014

Some APIs use semicolons within a QS parameter. e.g. stackexchange uses semicolons to seperate tags: http://api.stackexchange.com/2.1/search?order=desc&sort=activity&tagged=c%23;javascript&site=stackoverflow

khepin pushed a commit to khepin/angular.js that referenced this issue Feb 19, 2014
khepin pushed a commit to khepin/angular.js that referenced this issue Feb 19, 2014
According to RFC (http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2)
location should match either ';' OR '&', but not both at the same time.

Closes angular#6140
@Narretz Narretz modified the milestones: 1.4.x, 1.5.x May 27, 2016
@Narretz Narretz modified the milestones: 1.5.x, 1.7.x Apr 12, 2018
@petebacondarwin petebacondarwin self-assigned this May 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.