lib/onebox/helpers.rb in onebox-1.9.8 vs lib/onebox/helpers.rb in onebox-1.9.9

- old
+ new

@@ -199,11 +199,11 @@ # + MUST be encoded as %2B # in RFC3968 both query and fragment are defined as: # = *( pchar / "/" / "?" ) # CGI.escape turns space into + which is the most backward compatible # however it doesn't roundtrip through URI.unescape which prefers %20 - CGI.escape(query_string).gsub('+', '%20') + CGI.escape(query_string).gsub('%25', '%').gsub('+', '%20') end # Percent-encodes a URI string per RFC3986 - https://tools.ietf.org/html/rfc3986 def self.uri_encode(url) return "" unless url @@ -231,10 +231,13 @@ end.join('=') end.join('&') encoded += '?' + query_string end - encoded += '#' + uri_query_encode(parts[:fragment]) unless parts[:fragment].nil? + unless parts[:fragment].nil? + encoded += '#' + uri_query_encode(parts[:fragment])&.gsub('%21%2F', '!/') + end + encoded end def self.video_placeholder_html "<div class='onebox-placeholder-container'><span class='placeholder-icon video'></span></div>"