Skip to content

gitlab-api-v4: problem with whitespace in parameter parsing #10

@gregoa

Description

@gregoa

When I run

gitlab-api-v4 create_project --name="pperl" --namespace_id="2667" --visibility="public" --import_url="https://anonscm.debian.org/git/pkg-perl/attic/pperl.git" --description='Debian package pperl'

I get the error:

create_project must be called with 0 to 1 arguments at /usr/bin/gitlab-api-v4 line 86.

The problem is the parsing of parameter values in gitlab-api-v4 line 58: (=(\S+)|). So a value with whitespace, in my example the --description="Debian package pperl", doesn't match, the elsif fails, we don't have a $params->{description} but the whole string is pushed unto @args, and create_repo errors out.

With some Data::Dumper()ing:

$VAR1 = 'ARGV';
$VAR2 = 'create_project';
$VAR3 = '--name=pperl';
$VAR4 = '--namespace_id=2667';
$VAR5 = '--visibility=public';
$VAR6 = '--import_url=https://anonscm.debian.org/git/pkg-perl/attic/pperl.git';
$VAR7 = '--description=Debian package pperl';
$VAR8 = 'args';
$VAR9 = '--description=Debian package pperl';
$VAR10 = 'params';
$VAR11 = {
           'name' => 'pperl',
           'visibility' => 'public',
           'import_url' => 'https://anonscm.debian.org/git/pkg-perl/attic/pperl.git',
           'namespace_id' => '2667'
         };

(Unsurprisingly, a --description value without whitespace works.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions