Permalink
Browse files

Clean up logic surrounding file downloader matching

  • Loading branch information...
1 parent e0e2cc1 commit bb56f4dd317637f7b9b9978c28c44d5b0c1ae258 @mitchellh committed Sep 10, 2012
Showing with 8 additions and 1 deletion.
  1. +1 −0 CHANGELOG.md
  2. +7 −1 lib/vagrant/downloaders/file.rb
View
@@ -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 Downloaders
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)

0 comments on commit bb56f4d

Please sign in to comment.