FIX: URL encode whitespace character for card player

FIX: URL encode whitespace character for card player

diff --git a/lib/onebox/engine/whitelisted_generic_onebox.rb b/lib/onebox/engine/whitelisted_generic_onebox.rb
index bb378c6..aeac85c 100644
--- a/lib/onebox/engine/whitelisted_generic_onebox.rb
+++ b/lib/onebox/engine/whitelisted_generic_onebox.rb
@@ -307,7 +307,7 @@ module Onebox
       end
 
       def card_html
-        escaped_url = ::Onebox::Helpers.normalize_url_for_output(data[:player])
+        escaped_url = ::Onebox::Helpers.normalize_url_for_output(data[:player].gsub(' ', '%20'))
 
         <<~RAW
         <iframe src="#{escaped_url}"

GitHub sha: d703d062

This looks strange… shouldn’t normalize_url_for_output just take care of this, or some other helper?

2 Likes

That is correct. I was worried that this change might regress existing oneboxes since normalize_url_for_output is being used in multiple places. I verified that the fix is safe by testing various oneboxes locally and making sure that test suite is passing.

3 Likes