db-migrate / db-migrate-base

Base driver for db-migrate
Other
7 stars 16 forks source link

Escape doesn't escape anything at all when using double quotes #5

Open kornelski opened 7 years ago

kornelski commented 7 years ago

https://github.com/db-migrate/db-migrate-base/blob/05762f395e43643c2e9a1641e7b2a9492f34ae5a/index.js#L682

return str.replace(/"/g, '"');

The replacement string was probably meant to be '\\"'.

The code should be

return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42468457-escape-doesn-t-escape-anything-at-all-when-using-double-quotes?utm_campaign=plugin&utm_content=tracker%2F11792942&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F11792942&utm_medium=issues&utm_source=github).
wzrdtales commented 7 years ago

@pornel Yes you're right, that wont work quite well though. Thanks for point out :) Feel free to open a PR if you want to, I will have a look at this later on though.