mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
fix encoding display from result links
This commit is contained in:
parent
afef407744
commit
1463074f35
2 changed files with 4 additions and 1 deletions
|
@ -147,6 +147,9 @@ get '/browse/search' do
|
||||||
@total_results = @resp['searchInformation']['totalResults'].to_i
|
@total_results = @resp['searchInformation']['totalResults'].to_i
|
||||||
@resp['items'].each do |item|
|
@resp['items'].each do |item|
|
||||||
link = Addressable::URI.parse(item['link'])
|
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'
|
next if link.host == 'neocities.org'
|
||||||
|
|
||||||
username = link.host.split('.').first
|
username = link.host.split('.').first
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="result-url">
|
<div class="result-url">
|
||||||
<a href="<%= item['link'] %>"><%= item['link'] %></a>
|
<a href="<%= item['link'] %>"><%= item['readable_link'] %></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="result-snippet">
|
<p class="result-snippet">
|
||||||
|
|
Loading…
Add table
Reference in a new issue