mirror of
https://github.com/iv-org/invidious.git
synced 2024-06-07 19:40:52 +00:00
Fix URL-encoding in href strings (#2460)
* hrefs: replace HTML.escape w/ URI.encode_www_form * Fix search_query_encoded
This commit is contained in:
parent
f5e7fe34a5
commit
0947c26612
@ -41,7 +41,7 @@
|
|||||||
<div class="pure-g h-box">
|
<div class="pure-g h-box">
|
||||||
<div class="pure-u-1 pure-u-lg-1-5">
|
<div class="pure-u-1 pure-u-lg-1-5">
|
||||||
<% if page > 1 %>
|
<% if page > 1 %>
|
||||||
<a href="/add_playlist_items?list=<%= plid %>&q=<%= HTML.escape(query.not_nil!) %>&page=<%= page - 1 %>">
|
<a href="/add_playlist_items?list=<%= plid %>&q=<%= URI.encode_www_form(query.not_nil!) %>&page=<%= page - 1 %>">
|
||||||
<%= translate(locale, "Previous page") %>
|
<%= translate(locale, "Previous page") %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
||||||
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
||||||
<% if count >= 20 %>
|
<% if count >= 20 %>
|
||||||
<a href="/add_playlist_items?list=<%= plid %>&q=<%= HTML.escape(query.not_nil!) %>&page=<%= page + 1 %>">
|
<a href="/add_playlist_items?list=<%= plid %>&q=<%= URI.encode_www_form(query.not_nil!) %>&page=<%= page + 1 %>">
|
||||||
<%= translate(locale, "Next page") %>
|
<%= translate(locale, "Next page") %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
<div class="pure-g h-box">
|
<div class="pure-g h-box">
|
||||||
<div class="pure-u-1 pure-u-lg-1-5">
|
<div class="pure-u-1 pure-u-lg-1-5">
|
||||||
<% if page > 1 %>
|
<% if page > 1 %>
|
||||||
<a href="/channel/<%= ucid %>?page=<%= page - 1 %><% if sort_by != "newest" %>&sort_by=<%= HTML.escape(sort_by) %><% end %>">
|
<a href="/channel/<%= ucid %>?page=<%= page - 1 %><% if sort_by != "newest" %>&sort_by=<%= URI.encode_www_form(sort_by) %><% end %>">
|
||||||
<%= translate(locale, "Previous page") %>
|
<%= translate(locale, "Previous page") %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -104,7 +104,7 @@
|
|||||||
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
||||||
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
||||||
<% if count == 60 %>
|
<% if count == 60 %>
|
||||||
<a href="/channel/<%= ucid %>?page=<%= page + 1 %><% if sort_by != "newest" %>&sort_by=<%= HTML.escape(sort_by) %><% end %>">
|
<a href="/channel/<%= ucid %>?page=<%= page + 1 %><% if sort_by != "newest" %>&sort_by=<%= URI.encode_www_form(sort_by) %><% end %>">
|
||||||
<%= translate(locale, "Next page") %>
|
<%= translate(locale, "Next page") %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&list=<%= item.plid %>&listen=1">
|
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&list=<%= item.plid %>&listen=1">
|
||||||
<i class="icon ion-md-headset"></i>
|
<i class="icon ion-md-headset"></i>
|
||||||
</a>
|
</a>
|
||||||
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=HTML.escape("watch?v=#{item.id}&list=#{item.plid}")%>">
|
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=URI.encode_www_form("watch?v=#{item.id}&list=#{item.plid}")%>">
|
||||||
<i class="icon ion-md-jet"></i>
|
<i class="icon ion-md-jet"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -163,7 +163,7 @@
|
|||||||
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&listen=1">
|
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&listen=1">
|
||||||
<i class="icon ion-md-headset"></i>
|
<i class="icon ion-md-headset"></i>
|
||||||
</a>
|
</a>
|
||||||
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=HTML.escape("watch?v=#{item.id}")%>">
|
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=URI.encode_www_form("watch?v=#{item.id}")%>">
|
||||||
<i class="icon ion-md-jet"></i>
|
<i class="icon ion-md-jet"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
<div class="pure-u-1 pure-u-md-4-5"></div>
|
<div class="pure-u-1 pure-u-md-4-5"></div>
|
||||||
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
||||||
<% if continuation %>
|
<% if continuation %>
|
||||||
<a href="/channel/<%= ucid %>/playlists?continuation=<%= continuation %><% if sort_by != "last" %>&sort_by=<%= HTML.escape(sort_by) %><% end %>">
|
<a href="/channel/<%= ucid %>/playlists?continuation=<%= continuation %><% if sort_by != "last" %>&sort_by=<%= URI.encode_www_form(sort_by) %><% end %>">
|
||||||
<%= translate(locale, "Next page") %>
|
<%= translate(locale, "Next page") %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<title><%= search_query.not_nil!.size > 30 ? HTML.escape(query.not_nil![0,30].rstrip(".") + "...") : HTML.escape(query.not_nil!) %> - Invidious</title>
|
<title><%= search_query.not_nil!.size > 30 ? HTML.escape(query.not_nil![0,30].rstrip(".") + "...") : HTML.escape(query.not_nil!) %> - Invidious</title>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% search_query_encoded = env.get?("search").try { |x| URI.encode(x.as(String), space_to_plus: true) } %>
|
<% search_query_encoded = env.get?("search").try { |x| URI.encode_www_form(x.as(String), space_to_plus: true) } %>
|
||||||
|
|
||||||
<!-- Search redirection and filtering UI -->
|
<!-- Search redirection and filtering UI -->
|
||||||
<% if count == 0 %>
|
<% if count == 0 %>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<% if operator_hash.fetch("date", "all") == date %>
|
<% if operator_hash.fetch("date", "all") == date %>
|
||||||
<b><%= translate(locale, date) %></b>
|
<b><%= translate(locale, date) %></b>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?date:[a-z]+/, "") + " date:" + date) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil!.gsub(/ ?date:[a-z]+/, "") + " date:" + date) %>&page=<%= page %>">
|
||||||
<%= translate(locale, date) %>
|
<%= translate(locale, date) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
<% if operator_hash.fetch("content_type", "all") == content_type %>
|
<% if operator_hash.fetch("content_type", "all") == content_type %>
|
||||||
<b><%= translate(locale, content_type) %></b>
|
<b><%= translate(locale, content_type) %></b>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?content_type:[a-z]+/, "") + " content_type:" + content_type) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil!.gsub(/ ?content_type:[a-z]+/, "") + " content_type:" + content_type) %>&page=<%= page %>">
|
||||||
<%= translate(locale, content_type) %>
|
<%= translate(locale, content_type) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<% if operator_hash.fetch("duration", "all") == duration %>
|
<% if operator_hash.fetch("duration", "all") == duration %>
|
||||||
<b><%= translate(locale, duration) %></b>
|
<b><%= translate(locale, duration) %></b>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?duration:[a-z]+/, "") + " duration:" + duration) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil!.gsub(/ ?duration:[a-z]+/, "") + " duration:" + duration) %>&page=<%= page %>">
|
||||||
<%= translate(locale, duration) %>
|
<%= translate(locale, duration) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -68,11 +68,11 @@
|
|||||||
<% if operator_hash.fetch("features", "all").includes?(feature) %>
|
<% if operator_hash.fetch("features", "all").includes?(feature) %>
|
||||||
<b><%= translate(locale, feature) %></b>
|
<b><%= translate(locale, feature) %></b>
|
||||||
<% elsif operator_hash.has_key?("features") %>
|
<% elsif operator_hash.has_key?("features") %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/features:/, "features:" + feature + ",")) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil!.gsub(/features:/, "features:" + feature + ",")) %>&page=<%= page %>">
|
||||||
<%= translate(locale, feature) %>
|
<%= translate(locale, feature) %>
|
||||||
</a>
|
</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil! + " features:" + feature) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil! + " features:" + feature) %>&page=<%= page %>">
|
||||||
<%= translate(locale, feature) %>
|
<%= translate(locale, feature) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
<% if operator_hash.fetch("sort", "relevance") == sort %>
|
<% if operator_hash.fetch("sort", "relevance") == sort %>
|
||||||
<b><%= translate(locale, sort) %></b>
|
<b><%= translate(locale, sort) %></b>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?sort:[a-z]+/, "") + " sort:" + sort) %>&page=<%= page %>">
|
<a href="/search?q=<%= URI.encode_www_form(query.not_nil!.gsub(/ ?sort:[a-z]+/, "") + " sort:" + sort) %>&page=<%= page %>">
|
||||||
<%= translate(locale, sort) %>
|
<%= translate(locale, sort) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
Reference in New Issue
Block a user