Skip to content

Commit

Permalink
Remove file extension only when present
Browse files Browse the repository at this point in the history
If you name the machine to import without providing the extension then the old code will snip 4 characters off the end of the machine name.

Since the `.zip` extension is added to the name later it would be fine to just pass the machine name, if the behaviour was changed to only remove the extension when it exists. The regular expression used for removal matches the behaviour of the import.sh script (specifically `"${filename%.*}"`.
  • Loading branch information
matthewfranglen committed Oct 20, 2016
1 parent 6f68c56 commit bd63536
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion import.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (!machine) {
process.exit(1)
}

var machine = machine.substring(0, machine.length - 4)
var machine = machine.replace(/\.[^.]*$/, '')
var configDir = process.env.HOME + '/.docker/machine/machines/' + machine
try {
fs.statSync(configDir)
Expand Down

0 comments on commit bd63536

Please sign in to comment.