Elendev / composer-push

Provide a `push` command to composer to push to repositories
Apache License 2.0
48 stars 30 forks source link

Misleading error message when https:// is not specified in target URL #69

Open davidferlay opened 2 years ago

davidferlay commented 2 years ago

Steps to reproduce

docker run -it --user root:root --rm --init -v `pwd`:`pwd` -w `pwd` skilldlabs/php:74-fpm /bin/ash
composer global require elendev/composer-push --no-interaction
composer global config --no-plugins allow-plugins.elendev/composer-push true

Observed

composer push --url=repositories.XXX.com/repository/XXXX/ --username=XXXX --password="XXXX" 1.0.22

Returns error:

Pushing archive to URL: repositories.XXX.com/repository/XXX/packages/upload/XXX/formatter_video_popup/1.0.22...
  100 [============================]

  [GuzzleHttp\Exception\RequestException]                                                                                                                                                     
  cURL error 18: transfer closed with outstanding read data remaining (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://repositories.XXX.com/repository/XXXX/packages/upload/XXXX/formatter_video_popup/1.0.22                                                                                                                            

push [--name NAME] [--url URL] [--type TYPE] [--repository REPOSITORY] [--username USERNAME] [--password PASSWORD] [-i|--ignore [IGNORE]] [--ignore-dirs [IGNORE-DIRS]] [--ignore-by-git-attributes] [--ignore-by-composer] [--src-type SRC-TYPE] [--src-url SRC-URL] [--src-ref SRC-REF] [--keep-vendor] [--keep-dot-files] [--ssl-verify [SSL-VERIFY]] [--access-token [ACCESS-TOKEN]] [--] [<version>]

Whereas

composer push --url=https://repositories.XXX.com/repository/XXXX/ --username=XXXX --password="XXXX" 1.0.22

Returns success:

Pushing archive to URL: https://repositories.XXX.com/repository/XXXpackages/upload/XXX/formatter_video_popup/1.0.22...
  100 [============================]
Archive correctly pushed to the Nexus server

Expected

andypost commented 2 years ago

basically it could use filter_var() to make sure URL is valid