Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up logic surrounding file downloader matching

  • Loading branch information...
commit bb56f4dd317637f7b9b9978c28c44d5b0c1ae258 1 parent e0e2cc1
@mitchellh authored
Showing with 8 additions and 1 deletion.
  1. +1 −0  CHANGELOG.md
  2. +7 −1 lib/vagrant/downloaders/file.rb
View
1  CHANGELOG.md
@@ -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)
View
8 lib/vagrant/downloaders/file.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.