lib/gnome-campfire-notifications.rb in gnome-campfire-notifications-0.2.0 vs lib/gnome-campfire-notifications.rb in gnome-campfire-notifications-0.2.1
- old
+ new
@@ -29,11 +29,11 @@
def send_notification(item)
username = get_username(item["user_id"].to_i)
if should_send?(username, item["body"])
- system("notify-send --hint=int:transient:1 -u low#{icon} \"#{username}\" \"#{escape_double_quotes(item["body"])}\"")
+ system("notify-send --hint=int:transient:1 -u low#{icon} \"#{username}\" \"#{escape_for_bash(item["body"])}\"")
end
end
def get_username(id)
return "Unknown" if id.nil?
@@ -113,9 +113,9 @@
def room_url
"#{@config[:subdomain]}.campfirenow.com"
end
- def escape_double_quotes(string)
- string.gsub(/"/, '\"')
+ def escape_for_bash(string)
+ string.gsub(/("|`)/, '\\\\\\1')
end
end