You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing file which exists in C drive, 404 error occured during executing ruby script which exists in D drive.
I think Mechanize is trying to read file in D drive because uri.path is not include drive letter.
vendor/bundle/ruby/2.1.0/gems/mechanize-2.7.4/lib/mechanize/file_response.rb:12:in `read_body': 404 => Net::HTTPNotFound for file:/temp/xxx.html -- Mechanize::ResponseCodeError (Mechanize::ResponseCodeError)
so, I have worked around by the following monkey patch.
(uri.host is drive letter)
Mechanize::FileConnection
class Mechanize::FileConnection
def request uri, request
if RUBY_PLATFORM =~ /mingw/
yield Mechanize::FileResponse.new Mechanize::Util.uri_unescape uri.host + ":" + uri.path
else
yield Mechanize::FileResponse.new Mechanize::Util.uri_unescape uri.path
end
end
end
Are there good method to fix this problem ?
The text was updated successfully, but these errors were encountered:
my environment
ruby 2.1.6p336 (2015-04-13 revision 50298) [x64-mingw32]
mechanize 2.7.4
problem
In Windows,
URI::Generic#path
returns path which not include drive lettere.g)
Parsing file which exists in C drive, 404 error occured during executing ruby script which exists in D drive.
I think Mechanize is trying to read file in D drive because uri.path is not include drive letter.
so, I have worked around by the following monkey patch.
(uri.host is drive letter)
Mechanize::FileConnection
Are there good method to fix this problem ?
The text was updated successfully, but these errors were encountered: