From 58a06dc4559aee082fde3844e2f982719ab0752e Mon Sep 17 00:00:00 2001 From: Muhsin Date: Tue, 7 Oct 2025 17:03:35 +0530 Subject: [PATCH] fix: properly escape GraphQL strings in Linear mutations --- lib/linear/mutations.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/linear/mutations.rb b/lib/linear/mutations.rb index 5f34e602b..7e43a9e50 100644 --- a/lib/linear/mutations.rb +++ b/lib/linear/mutations.rb @@ -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(', ')}]"