Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upEndpoints do not correctly support URI-Ms containing query strings #126
Comments
shawnmjones
added
the
bug
label
Sep 5, 2018
shawnmjones
self-assigned this
Sep 5, 2018
added a commit
that referenced
this issue
Sep 5, 2018
added a commit
that referenced
this issue
Sep 5, 2018
added a commit
that referenced
this issue
Sep 5, 2018
added a commit
that referenced
this issue
Sep 5, 2018
shawnmjones
closed this
in
a4a9df9
Sep 5, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shawnmjones commentedSep 5, 2018
MementoEmbed trims the query string off of URI-Ms:
The problem exists in all services due to an incorrect assumption of how the
path:subpath
variable is handled by Flask. Code for the social card service is below:MementoEmbed/mementoembed/services/product.py
Lines 107 to 124 in 224e866
Instead of returning the rest of the path within the variable
subpath
on line 110, Flask instead strips off the query string and stores it in theargs
array of itsrequest
object. Thepath
method of therequest
object does not have the query string, either.This can be fixed by:
query_string
member of therequest
objectfull_path
member of therequest
object and removing the service endpoint from this string, essentially ignoring the<path:subpath>
capabilities of Flask altogether, replacing line 110 with something likeurim = request.full_path.replace('/services/product/socialcard/', '')
- this can be made service-specificurim = request.full_path[29:]
- this is also service specific, but avoids any potential string collisions with the actual URI-MThis will also have to be repeated for all service endpoints:
/services/product/thumbnail/
/services/product/socialcard/
/services/memento/contentdata/
/services/memento/bestimage/
/services/memento/archivedata/
/services/memento/originalresourcedata/