exception=>#<CSV::MalformedCSVError: Illegal quoting in line 1.>

You data does not match either regexp. It is not words separated by colons, and it is not words separated by equals signs, so it goes through the csv filter. csv fields have to be quoted correctly. The field must start and end with " (if quotes are present at all) and any quotes within the field must be escaped with a second double quote. So something like foo,"a""b""c",bar would be a valid 3 field csv.

You need another branch to your if-else and another filter to parse that data.