fix: Encode URL for cog_viewer and stac_viewer #961
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I am changing
/viewer
endpoint, it won't work as the first query to/info
doesn't go through. I tried encoding my urls with an online tool (https://www.urlencoder.org/) and it works perfectly fine. Calling the/info
endpoint from the docs works as expected with the URL as-is, so I took a look at the Viewer template.How I did it
encodeURIComponent
function to the introduced URL that does the same thing as the URL encoder referenced above. The change is minimal.How you can test it
http://s3.mydomain.com/user-data/cog/MAD.tiff?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXX&X-Amz-Date=20240731T071151Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&X-Amz-Signature=XXXXXXXXXX
Related Issues