Skip to content

Consider using JSON.parse instead of eval #4

@neatonk

Description

@neatonk

From freesound.js#L84-87...

if (xhr.readyState === 4 && [200,201,202].indexOf(xhr.status)>=0){
    var data = eval("(" + xhr.responseText + ")");
    if(success) success(wrapper?wrapper(data):data);
}

I believe xhr.responseText is a JSON string, in which case JSON.parse can be used to safely parse the data. Is there a reason eval is used instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions