diff --git a/plugins/certs/commands b/plugins/certs/commands index cd568579288..82f62ccb428 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -39,7 +39,7 @@ certs_set() { cd $TEMP_DIR tar xvf - <&0 - CRT_FILE_SEARCH=$(find . -type f -name "*.crt") + CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.crt") CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^') if [[ $CRT_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .crt file" @@ -49,7 +49,7 @@ certs_set() { CRT_FILE=$CRT_FILE_SEARCH fi - KEY_FILE_SEARCH=$(find . -type f -name "*.key") + KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key") KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^') if [[ $KEY_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .key file" diff --git a/tests/unit/10_certs.bats b/tests/unit/10_certs.bats index f127a66f167..a827ad6c9f7 100644 --- a/tests/unit/10_certs.bats +++ b/tests/unit/10_certs.bats @@ -38,6 +38,13 @@ teardown() { assert_success } +@test "(certs) certs:add < tar should ignore OSX hidden files" { + run bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/osx_ssl_tarred.tar" + echo "output: "$output + echo "status: "$status + assert_success +} + @test "(certs) certs:info" { run bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar && dokku certs:info $TEST_APP" echo "output: "$output diff --git a/tests/unit/osx_ssl_tarred.tar b/tests/unit/osx_ssl_tarred.tar new file mode 100644 index 00000000000..0d72adc26ec Binary files /dev/null and b/tests/unit/osx_ssl_tarred.tar differ