Fix for "s3 key with url like /?foo=bar
with query on /
path, leads to error when reading .createReadStream()"
#23
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.
If I have a defaultKey such as index.html, and I request a / route with a query string, e.g., /?foo=bar. If i do this, that first if statement thats supposed to replace "" with defaultKey, s3Key will be ?foo=bar and my defaultKey will not be used. The code continues and removes the query string from the s3Key making it s3Key = "". If my s3Key is passed to the s3Params as a blank string, which is passed to s3Request and finally when we call s3Request.createReadStream(), a 500 error is thrown by aws param_validator: UriParameterError: Expected uri parameter to have length >= 1, but found "" for params.Key. \n\n this fix removes the query string first since there is really nouse for it, to have the if that replaces "/" with defaultKey will work even if there is a query string.