Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of spaces for package names in composer search/composer require commands #10500

Merged
merged 1 commit into from Feb 4, 2022

Conversation

realFlowControl
Copy link
Contributor

Hello there 馃枛

I found out while using composer search that I can not search for two words with a space in between:

$ composer search ramsey commits

[Composer\Downloader\TransportException]
curl error 3 while downloading https://packagist.org/search.json?q=ramsey commits&type=: URL using bad/illegal format or missing URL

search [-N|--only-name] [-t|--type TYPE] [-f|--format FORMAT] [--] <tokens> (<tokens>)...

Same is true for using composer require:

$ composer require
Search for a package: ramsey commits

[Composer\Downloader\TransportException]
curl error 3 while downloading https://packagist.org/search.json?q=ramsey commits&type=: URL using bad/illegal format or missing URL

I do not know for the composre require command, but for the composer search command such a usage is documented via the composer help search command, so I assumed it is the expected behavior for this to work.

With this PR applied those two commands behave as following:

$ ./bin/composer require
Search for a package: ramsey commits

Found 1 packages matching ramsey commits

   [0] ramsey/conventional-commits

Enter package # to add, or the complete package name if it is not listed:
[...]

and

./bin/composer search ramsey commits
ramsey/conventional-commits A PHP library for creating and validating commit messages according to the Conventional Commits specification. In...

What do you think?

Kind regards
Florian

@realFlowControl realFlowControl changed the title Fix spaces in composer search or composer require commands Fix usage of spaces for package names in composer search or composer require commands Feb 1, 2022
@realFlowControl realFlowControl changed the title Fix usage of spaces for package names in composer search or composer require commands Fix usage of spaces for package names in composer search/composer require commands Feb 1, 2022
@Seldaek
Copy link
Member

Seldaek commented Feb 4, 2022

Weird because I cannot reproduce this:

$ composer search ramsey commits -vvv
[...]
Downloading https://packagist.org/search.json?q=ramsey commits&type=
[200] https://packagist.org/search.json?q=ramsey commits&type=
ramsey/conventional-commits A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

That said, it makes absolute sense to urlencode here regardless of space handling, so thanks :)

@Seldaek Seldaek merged commit 3d82719 into composer:2.2 Feb 4, 2022
@Seldaek Seldaek added the Bug label Feb 4, 2022
@Seldaek Seldaek added this to the 2.2 milestone Feb 4, 2022
@realFlowControl realFlowControl deleted the fix-spaces-in-package-search branch February 4, 2022 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants