cellminer icon indicating copy to clipboard operation
cellminer copied to clipboard

[PATCH] Specifying just --username results in undefined method `gsub' for nil:NilClass (NoMethodError)

Open devurandom opened this issue 13 years ago • 1 comments

 # ./cellminer --username USER POOL_URI
/usr/lib64/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for nil:NilClass (NoMethodError)
        from /usr/lib64/ruby/1.9.1/uri/common.rb:623:in `escape'
        from /root/cellminer/bitcoin.rb:48:in `rpc_proxy'
        from /root/cellminer/cellminer.rb:120:in `initialize'
        from ./cellminer:24:in `new'
        from ./cellminer:24:in `<main>'

devurandom avatar Apr 10 '13 09:04 devurandom

PATCH:

diff --git a/bitcoin.rb b/bitcoin.rb
index 81d7b9f..119d1c6 100644
--- a/bitcoin.rb
+++ b/bitcoin.rb
@@ -45,6 +45,9 @@ module Bitcoin
     # This is a workaround; URI needs escaped username and password
     if username
       uri.user     = URI.escape username, /[^#{URI::PATTERN::UNRESERVED}]/
+      uri.password = ''
+    end
+    if password
       uri.password = URI.escape password, /[^#{URI::PATTERN::UNRESERVED}]/
     end

devurandom avatar Apr 10 '13 14:04 devurandom