From 62f54501bbb47e2ad167eeff2cc47884734337d9 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Tue, 16 Dec 2025 00:10:21 +0530 Subject: [PATCH] Fix Linear mutation string escaping --- lib/linear/mutations.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/linear/mutations.rb b/lib/linear/mutations.rb index 5f34e602b..c4e4028fb 100644 --- a/lib/linear/mutations.rb +++ b/lib/linear/mutations.rb @@ -2,8 +2,8 @@ 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 escaped for GraphQL + value.to_json when Array # Arrays need to be recursively converted "[#{value.map { |v| graphql_value(v) }.join(', ')}]" @@ -47,7 +47,7 @@ module Linear::Mutations <<~GRAPHQL mutation { - attachmentLinkURL(url: "#{link}", issueId: "#{issue_id}", title: "#{title}"#{user_params_str}) { + attachmentLinkURL(url: #{graphql_value(link)}, issueId: #{graphql_value(issue_id)}, title: #{graphql_value(title)}#{user_params_str}) { success attachment { id