Compare commits

...
Author SHA1 Message Date
Muhsin 58a06dc455 fix: properly escape GraphQL strings in Linear mutations 2025-10-07 17:03:35 +05:30
+3 -2
View File
@@ -2,8 +2,9 @@ module Linear::Mutations
def self.graphql_value(value)
case value
when String
# Strings must be enclosed in double quotes
"\"#{value.gsub("\n", '\\n')}\""
# Strings must be enclosed in double quotes and properly escaped
escaped = value.gsub('\\', '\\\\').gsub('"', '\\"').gsub("\n", '\\n').gsub("\r", '\\r').gsub("\t", '\\t')
"\"#{escaped}\""
when Array
# Arrays need to be recursively converted
"[#{value.map { |v| graphql_value(v) }.join(', ')}]"