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

Encoding problem listing collections? #90

Closed
cronosun opened this issue Sep 13, 2016 · 2 comments
Closed

Encoding problem listing collections? #90

cronosun opened this issue Sep 13, 2016 · 2 comments

Comments

@cronosun
Copy link

According to the spec (https://tools.ietf.org/html/rfc3986#page-13), those chars are allowed in url path sements:

pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="
path-abempty  = *( "/" segment )
segment       = *pchar

Reproduction:
Open Postman and PUT those resources to the gateleen storage (body does not matter) - note: only the last segment of the URL does matter:

  • http://nemotest.pnet.ch:7012/nemo/server/tests/collection/1_hello-$&()*+,;=
  • http://nemotest.pnet.ch:7012/nemo/server/tests/collection/2_hello-$&()*+,;=
  • http://nemotest.pnet.ch:7012/nemo/server/tests/collection/3_hello-$&()*+,;=
  • http://nemotest.pnet.ch:7012/nemo/server/tests/collection/1_hello-:$&()*+,;=
  • http://nemotest.pnet.ch:7012/nemo/server/tests/collection/4_hello-:@$&()*+,;=

Those path segments do not contain characters that need to be percent encoded (according to the spec).

Now do a GET using postman:

http://nemotest.pnet.ch:7012/nemo/server/tests/collection/

Result

{
  "collection": [
    "1_hello-$&()*+,;=",
    "1_hello-§$&()*+,;=",
    "2_hello-$&()*+,;=",
    "3_hello-$&()*+,;=",
    "4_hello-§@$&()*+,;="
  ]
}

Note those two results - the character § - originally this was ::

  • 1_hello-§$&()*+,;=
  • 4_hello-§@$&()*+,;=

GETing the resources (GET works with the URL used in PUT but DOES NOT work using the URL returned by the collection listing):

  • 404: http://nemotest.pnet.ch:7012/nemo/server/tests/collection/4_hello-§@$&()*+,;=
  • 404: http://nemotest.pnet.ch:7012/nemo/server/tests/collection/1_hello-§$&()*+,;=
  • 200: http://nemotest.pnet.ch:7012/nemo/server/tests/collection/4_hello-:@$&()*+,;=
  • 200: http://nemotest.pnet.ch:7012/nemo/server/tests/collection/1_hello-:$&()*+,;=

The problem can also be reproduced using the GUI:

problem_grafisch

@cronosun
Copy link
Author

Addition:
Similar problem also happens with expand=1.

Reproduction

PUT http://localhost:3332/gurgle_persistence/test/4_hello-:@$&()*+,;=
Request-Body (Json)

{
    "hello" : "world1"
}

PUT http://localhost:3332/gurgle_persistence/test/1_hello-:$&()*+,;=

{
    "hello" : "world2"
}

GET GET http://localhost:3332/gurgle_persistence/test?expand=1
STATUS = 200
Content-Length →53
Content-Type →application/json; charset=utf-8
Body (not valid json):

{"test":["1_hello-§$&()*+,;=","4_hello-§@$&()*+,;="

Postman result:
problem_storage_expand

Gegencheck: OK
PUT http://localhost:3332/gurgle_persistence/test2/hello1

{
    "hello" : "world1"
}

PUT http://localhost:3332/gurgle_persistence/test2/hello2

{
    "hello" : "world2"
}

GET http://localhost:3332/gurgle_persistence/test?expand=1
Response

{
  "test2": [
    "hello1",
    "hello2"
  ]
}

@floriankammermann
Copy link
Contributor

This issue was moved to swisspost/vertx-rest-storage#28

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