jin5354 / alfred3-workflow-CurrencyConvert

This alfred3 workflow can convert currency conveniently.
292 stars 32 forks source link

Can't use if i turn on system proxy #24

Closed sephrioth closed 5 years ago

sephrioth commented 5 years ago

If i set the system http & https proxy to 127.0.0.1:6152, here is the error log.

ERROR: Currency Convert[Script Filter] Code 1: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): "127.0.0.1:6152127.0.0.1:6152" (URI::InvalidURIError)

Here is the log when i set proxy to http/https proxy to 127.0.0.1:6152

ERROR: Currency Convert[Script Filter] Code 1: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): "127.0.0.1:6152" (URI::InvalidURIError)

btyh17mxy commented 5 years ago

run into this error too, and I found out that is because the http_proxy environment does not start with "http://". also I have found a workaround, add these to convert.rb (after line 15).

http_proxy = ENV["http_proxy"]
unless http_proxy.to_s.empty?
    unless http_proxy.start_with?("http")
        ENV["http_proxy"] = "http://#{ENV["http_proxy"]}"
    end
end
sephrioth commented 5 years ago

Work like a charm, thank you. @btyh17mxy

btyh17mxy commented 5 years ago

Work like a charm, thank you. @btyh17mxy

Surge user I presume?

sephrioth commented 5 years ago

Work like a charm, thank you. @btyh17mxy

Surge user I presume?

Yes, but how do you find it out?