Skip to content

Retain the backslash on escaped single quotes when generating a hash from a flattened string.

Marek Szuba requested to merge github/fork/james-monkeyshines/master into master

Created by: james-monkeyshines

Data::Dumper is used to flatten hashes into strings, for insertion into the 'external_data' columns of some tables. By default, it uses single quotes, and automatically does any necessary escaping. The code to subsequently extract the values from the 'external_data' column removed all backslashes, resulting in an invalid hash; e.g. 'Desc' => '3\'UTR', becomes 'Desc' => '3'UTR',. Because Data::Dumper escapes backslashes, we can remove all superfluous backslashes by removing all double-backslash instances, which leaves the single-backslash-escaped quotes intact.

Merge request reports