Clean up logic surrounding file downloader matching
This commit is contained in:
parent
e0e2cc1974
commit
bb56f4dd31
|
@ -47,6 +47,7 @@
|
|||
- Add missing translation for "saving" state on VirtualBox. [GH-1110]
|
||||
- Proper error message if the remote end unexpectedly resets the connection
|
||||
while downloading a box over HTTP. [GH-1090]
|
||||
- Allow "file://" URLs for box URLs. [GH-1087]
|
||||
|
||||
## 1.0.3 (May 1, 2012)
|
||||
|
||||
|
|
|
@ -8,7 +8,13 @@ module Vagrant
|
|||
class File < Base
|
||||
def self.match?(uri)
|
||||
extracted = URI.extract(uri, "file")
|
||||
(extracted && extracted.include?(uri)) || ::File.file?(::File.expand_path(uri))
|
||||
|
||||
# We match if we got a file URI. It doesn't matter here if the file
|
||||
# doesn't exist because we check again later as well.
|
||||
return true if extracted && extracted.include?(uri)
|
||||
|
||||
# Otherwise we match if the file exists
|
||||
return ::File.file?(::File.expand_path(uri))
|
||||
end
|
||||
|
||||
def download!(source_url, destination_file)
|
||||
|
|
Loading…
Reference in New Issue