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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gitlab driver] 404 on urlencode the repository name #6064

Closed
fezfez opened this issue Jan 13, 2017 · 8 comments
Closed

[Gitlab driver] 404 on urlencode the repository name #6064

fezfez opened this issue Jan 13, 2017 · 8 comments
Labels
Milestone

Comments

@fezfez
Copy link

fezfez commented Jan 13, 2017

My composer.json:

{
    "description" : "File Parser",
    "type" : "library",
    "require" : {
       "psr/log" : "~1.0",
       "ulysse/file-iterator" : "~0.1",
       "symfony/validator": "^2.8",
       "symfony/config": "^2.8"
    },
    "require-dev" : {
        "phpunit/phpunit" : "~4.8"
    },
    "repositories": [
        { "type": "gitlab", "url": "https://gitlab.*******.fr/ulysse/file-iterator" }
    ],
    "prefer-stable" : true,
    "config": {
        "platform" : {
            "php": "5.4"
        },
        "gitlab-domains": ["https://gitlab.******.fr"]
    }
}

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: *****
Dev Public Key Fingerprint: ******
OK
Checking composer version: OK

When I run this command:

composer update

I get the following output:

composer update
Loading composer repositories with package information
Failed to download ulysse/file-iterator:The "https://gitlab.******.fr/api/v3/projects/ulysse%2Ffile%2Diterator" file could not be downloaded (HTTP/1.1 404 Not Found)
Your credentials are required to fetch private repository metadata (https://gitlab.*****.fr/ulysse/file-iterator)
A token will be created and stored in "C:/******/AppData/Roaming/Composer/auth.json", your password will never be stored
To revoke access to this token you can visit gitlab.******.fr/profile/applications
Username: ******
Password:
Token successfully created


  [Composer\Downloader\TransportException]
  The "https://gitlab.******.fr/api/v3/projects/ulysse%2Ffile%2Diterator" file could not be downloaded (HTTP/1.1 404 Not Found)


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

And I expected this to happen:
I simply expected to work :)

I believe that the encoding of the url in the repository name, especially for the "-" char is wrong. (https://github.com/composer/composer/blob/master/src/Composer/Repository/Vcs/GitLabDriver.php#L223)

A simple test on public gitlab repo.

https://gitlab.com/gitlab-org/gitlab-ee [200 OK]
https://gitlab.com/gitlab-org/gitlab%2Dee [302 Found]

On my private repo

https://gitlab.****.fr/ulysse/file-iterator [200 OK]
https://gitlab.*****.fr/ulysse/file%2Diterator[404 Not Found]

gitlab version 8.15.2
Composer version 1.3.1 2017-01-07 18:08:51

@alcohol alcohol added the Bug label Jan 15, 2017
@alcohol
Copy link
Member

alcohol commented Jan 15, 2017

This looks like a bug, but will need further investigation.

@Seldaek
Copy link
Member

Seldaek commented Jan 22, 2017

/cc @calin-marian who did the initial url encoding PR. Do you think it would be fine to not encode -? It seems to me like it would be ok.

@Seldaek Seldaek added this to the 1.3 milestone Jan 22, 2017
@alcohol
Copy link
Member

alcohol commented Jan 23, 2017

I think the original encoding solution was because package names with / in them resulted in errors (since it is also a valid path separator in urls). Skipping the encoding for - should probably not be an issue since it holds no special meaning in urls.

@fezfez
Copy link
Author

fezfez commented Jan 27, 2017

thanks @Seldaek

@amustill
Copy link

amustill commented Feb 3, 2017

I'm currently experiencing the same issue with version 1.3.2 2017-01-27 18:23:41.

My composer.json with sensitive items redacted.

{
    "name": "adam/private-gitlab-test",
    "require": {
        "group/project-name": "dev-master"
    },
    "repositories": [
        {
            "type": "gitlab",
            "url":  "https://git.domain.com/group/project-name"
        }
    ],
    "config": {
        "gitlab-domains": ["https://git.domain.com"]
    }
}
composer update
Failed to download group/project-name:The "https://git.domain.com/api/v3/projects/group%2Fproject-name" file could not be downloaded (HTTP/1.1 404 Not Found)

Hitting the URL https://git.domain.com/api/v3/projects/group%2Fproject-name directly in Chrome works.

@fezfez
Copy link
Author

fezfez commented Feb 3, 2017

For me, it solve the issue.
@amustill : Be careful on project visibility, for my case the value is "Public"

@amustill
Copy link

amustill commented Feb 3, 2017

@fezfez I guess project visibility is the issue here although Composer is generating a valid API token for my user okay. It's a strange user experience.

@stoiev
Copy link

stoiev commented Jun 5, 2017

I've got same issue on 1.4.2 using a composer.json similar to yours.
The problem was resolved removing https:// from gitlab-domains in config object

"config": {
    "platform" : {
        "php": "5.4"
    },
    "gitlab-domains": ["gitlab.******.fr"]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants