mirror of
https://github.com/ticky/wayback-classic.git
synced 2026-09-08 11:20:04 -04:00
Add handling of user-agents which don't honour page encodings
This commit is contained in:
1 parent
ed8d826666
commit
86b24f48aa
10 files changed
+75
-18
No files matched your search
+5
-2
@@ -10,8 +10,11 @@ require 'erb'
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
|
||||
require_relative 'lib/encoding'
|
||||
require_relative 'lib/utils'
|
||||
|
||||
utf8, encoding_override = detect_client_encoding
|
||||
|
||||
CGI.new.tap do |cgi|
|
||||
if cgi.params.keys - ["q"] != [] || cgi.params["q"]&.first.empty?
|
||||
raise StandardError.new("A `q` parameter must be supplied, and no other parameters are accepted")
|
||||
@@ -29,7 +32,7 @@ CGI.new.tap do |cgi|
|
||||
|
||||
if data["isUrl"]
|
||||
# Redirect to History page
|
||||
redirect_uri = uri "/cgi-bin/history.cgi", q: query
|
||||
redirect_uri = uri "/cgi-bin/history.cgi", q: query, utf8: utf8
|
||||
|
||||
cgi.out "type" => "text/html",
|
||||
"charset" => "UTF-8",
|
||||
@@ -39,7 +42,7 @@ CGI.new.tap do |cgi|
|
||||
end
|
||||
else
|
||||
# Redirect to Search page
|
||||
redirect_uri = uri "/cgi-bin/search.cgi", q: query
|
||||
redirect_uri = uri "/cgi-bin/search.cgi", q: query, utf8: utf8
|
||||
|
||||
cgi.out "type" => "text/html",
|
||||
"charset" => "UTF-8",
|
||||
|
||||
Reference in new issue
Block a user