Sunday, 4 June 2017

url with % doesn't get to api

Hi trying to get a signUrl from S3, for some reason making the call with % isn't parse correctly by my code. I get a 404 not found.

This is the ajax request -

https://stage.musicmarkers.com/website/api/admin/get-signed-url/thumbnail/magazine%2F2BE.gif/image%2Fgif

My Api-

app.get('/website/api/admin/get-signed-url/thumbnail/:key/:type', auth.getMember, directives.noCache, getThumbnailSingedUrl);

My function-

function getThumbnailSingedUrl(req, res) {

if (!isAdmin(req, res)) {
    return;
}


var key = req.params.key || '';
var type = req.params.type || '';

ThumbnailBucketFacade.getSignedUrl(
    'putObject',
    key,
    type,
    function onGotSignedUrl(error, result) {
        if (error) {
            RestResponse.serverError(res, error);
        } else {
            RestResponse.ok(res, result);
        }
    });

}

Making the call in a dev environment works.

Making the call without % environment works.

same code exactly in a different project works.

any ideas ??



via utabmedia

No comments:

Post a Comment