oduwsdl / MemGator

A Memento Aggregator CLI and Server in Go
https://memgator.cs.odu.edu/api.html
MIT License
56 stars 11 forks source link

Handle URL-encoded URI-R #110

Closed ibnesayeed closed 3 months ago

ibnesayeed commented 6 years ago
$ curl -i https://memgator.cs.odu.edu/timemap/link/http%3A%2F%2Fexample.org%2Findex.html
HTTP/1.1 400 Bad Request
Content-Length: 55
Content-Type: text/plain; charset=utf-8
Date: Mon, 29 Jan 2018 02:16:27 GMT
X-Content-Type-Options: nosniff
X-Generator: MemGator:1.0-rc7

Malformed URI-R: http%3A%2F%2Fexample.org%2Findex.html

The above should behave the same way as below:

$ curl -i https://memgator.cs.odu.edu/timemap/link/http://example.org/index.html
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Link, Location, X-Memento-Count, X-Generator
Content-Type: application/link-format
Date: Mon, 29 Jan 2018 02:17:17 GMT
X-Generator: MemGator:1.0-rc7
X-Memento-Count: 55
Transfer-Encoding: chunked

<http://example.org/index.html>; rel="original",
...
ibnesayeed commented 6 years ago

Using PathUnescape function should quickly fix it, but implications of possible spaces in the unescaped URI-R needs to be investigated.