symfony / flex

Composer plugin for Symfony
MIT License
4.17k stars 183 forks source link

recipe_template_relative processing is broken for gitlab private recipe #1022

Open p-golovin opened 7 months ago

p-golovin commented 7 months ago

I configure flex endpoint for private gitlab repo with this instruction: https://symfony.com/doc/current/setup/flex_private_recipes.html#gitlab-3

{
    "extra": {
        "symfony": {
            "endpoint": [
                "https://gitlab.com/api/v4/projects/your-gitlab-project-id/repository/files/index.json/raw?ref=main",
                "flex://defaults"
            ]
        }
    }
}

And use recipe_template_relative key in recipes index.json.

Regexp doesn't work correctly in https://github.com/symfony/flex/blob/2.x/src/Downloader.php#L222, it replace not index.json with relative path, but raw:

Failed to download recipe: The "https://gitlab.com/api/v4/projects/my-project-id/repository/files/index.json/my-vendor.my-package.1.0.json?ref=main" file could not be downloaded (HTTP/2 404 ):
{"error":"404 Not Found"}