fix encoding display from result links

This commit is contained in:
Kyle Drake 2024-12-12 17:05:22 -06:00
parent afef407744
commit 1463074f35
2 changed files with 4 additions and 1 deletions

View file

@ -147,6 +147,9 @@ get '/browse/search' do
@total_results = @resp['searchInformation']['totalResults'].to_i
@resp['items'].each do |item|
link = Addressable::URI.parse(item['link'])
item['readable_link'] = link.host+Rack::Utils.unescape(Rack::Utils.unescape(link.path)) # Yes, it needs to be decoded twice
item['link'] = link
next if link.host == 'neocities.org'
username = link.host.split('.').first

View file

@ -93,7 +93,7 @@
</h3>
<div class="result-url">
<a href="<%= item['link'] %>"><%= item['link'] %></a>
<a href="<%= item['link'] %>"><%= item['readable_link'] %></a>
</div>
<p class="result-snippet">