Closed claustres closed 3 years ago
Probably linked to the fact that to handle something like this you need to use a wildcard in Express like app.get('/service/*')
& req.params[0]
while Feathers probably uses a standard parameter like app.get('/service/:id')
& req.params.id
.
I was able to overcome this - just encodeURIComponent(id)
so the slashes get converted to %2f
Good catch, could you push a PR on this or point out where you added this fix? Thanks
I actually implemented this on the client side - as a simple before get hook.
context => {
if(context.id.indexOf('/') > -1) {
context.id = encodeUriComponent(context.id);
}
return context;
}
OK, as with REST the ID is part of the URL it should be encoded upfront so that it is correctly decoded, it will not help to try to encode it on the backend before calling AWS.
I think we can close this issue with your fix.
Steps to reproduce
Create a storage service targeting a S3 bucket like
bucket
. Try to access an object in a "sub-directory" with a key likebucket/sub/file
.Expected behavior
The object is correctly retrieved.
Actual behavior
A 404 error is raised. It's probably because express interpret the id with a
/
as a different route.System configuration
Tell us about the applicable parts of your setup.
Module versions: 2.1
NodeJS version: 8.16
Operating System: Windows