PlaceholderAPI / Javascript-Expansion

Adds javascript placeholders
GNU General Public License v3.0
22 stars 24 forks source link

Strings not translated properly #46

Open gecko10000 opened 3 years ago

gecko10000 commented 3 years ago

When placeholders are replaced while parsing a placeholder, they are not translated into string form properly. If the placeholder contains " at all, the script will break. For example, in this case the user can set whatever AFK message they want:

afk = "%cmi_user_afk_msg%";

function formatAFK() { return afk == "" ? "" : ": " + afk; }

formatAFK();

but if they set it to " the script errors and points to an unclosed quote on the first line. A solution to this would be to either translate the string to replace special characters like quotes and backslashes before putting it into the script, or having an option for this in javascript_placeholders.yml.

BlitzOffline commented 3 years ago

Just to explain his issue better, strings are translated properly.

The problem is that placeholders are parsed before and if they contain double quotes they basically don't get escaped. They want an option that would basically escape characters after parsing the placeholders and then set them in variables.