File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 88# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
99
1010require 'open-uri'
11+ require 'uri'
1112
1213module Automatic ::Plugin
1314 class StoreFile
@@ -46,17 +47,19 @@ def run
4647 end
4748
4849 private
50+
4951 def wget ( url )
50- filename = url . split ( /\/ / ) . last
52+ uri = URI . parse ( url )
53+ filename = File . basename ( uri . path )
5154 filepath = File . join ( @config [ 'path' ] , filename )
5255 open ( url ) { |source |
5356 open ( filepath , "w+b" ) { |o |
5457 o . print source . read
5558 }
5659 }
57- uri_scheme = "file://" + filepath
58- Automatic ::Log . puts ( "info" , "Saved: #{ uri_scheme } " )
59- uri_scheme
60+ return_uri = URI . join ( "file://" + filepath )
61+ Automatic ::Log . puts ( "info" , "Saved: #{ return_uri . path } " )
62+ return_uri . path
6063 end
6164 end
6265end
You can’t perform that action at this time.
0 commit comments