what-changed icon indicating copy to clipboard operation
what-changed copied to clipboard

Redirect support

Open ostrolucky opened this issue 5 years ago • 5 comments

I'm getting some error related to redirect

  mtdowling/jmespath.php 52168cb9..42dae2cb
dantleech/whatchanged: ERROR: Unexpected response from Github: "{
    "message": "Moved Permanently",
    "url": "https:\/\/api.github.com\/repositories\/8300763\/compare\/52168cb9472de06979613d365c7f1ab8798be895...42dae2cbd13154083ca6d70099692fef8ca84bfb",
    "documentation_url": "https:\/\/docs.github.com\/v3\/#http-redirects"
}"

composer.lock related section (after update):

        {
            "name": "mtdowling/jmespath.php",
            "version": "2.6.0",
            "source": {
                "type": "git",
                "url": "https://github.com/jmespath/jmespath.php.git",
                "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb",
                "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb",
                "shasum": ""
            },
            "require": {
                "php": "^5.4 || ^7.0 || ^8.0",
                "symfony/polyfill-mbstring": "^1.17"
            },
            "require-dev": {
                "composer/xdebug-handler": "^1.4",
                "phpunit/phpunit": "^4.8.36 || ^7.5.15"
            },
            "bin": [
                "bin/jp.php"
            ],
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "2.6-dev"
                }
            },
            "autoload": {
                "psr-4": {
                    "JmesPath\\": "src/"
                },
                "files": [
                    "src/JmesPath.php"
                ]
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Michael Dowling",
                    "email": "[email protected]",
                    "homepage": "https://github.com/mtdowling"
                }
            ],
            "description": "Declaratively specify how to extract elements from a JSON document",
            "keywords": [
                "json",
                "jsonpath"
            ],
            "time": "2020-07-31T21:01:56+00:00"
        }

ostrolucky avatar Aug 07 '20 13:08 ostrolucky

Could maybe be a simple as enabling rediect in CuRL? https://github.com/dantleech/what-changed/blob/1c21a4a1e71723c104523a61f7c356b5aac4df35/lib/Adapter/Github/Client/CurlGithubClient.php#L35

dantleech avatar Aug 08 '20 07:08 dantleech

Looks like it will be more complicated than that. Doing such change now results into

mtdowling/jmespath.php 52168cb9..42dae2cb


  [DTL\WhatChanged\Exception\WhatChangedRuntimeException]
  Unexpected response from Github: "{
      "message": "Not Found",
      "documentation_url": "https:\/\/docs.github.com\/rest\/reference\/repos#compare-two-commits"
  }"


what-changed [--merge-commits] [-F|--full-message]

Curl confirms

❯ curl -L  https://api.github.com/repos/jmespath/jmespath/compare/52168cb9472de06979613d365c7f1ab8798be895...42dae2cbd13154083ca6d70099692fef8ca84bfb
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#compare-two-commits"
}

So I wonder how composer/packagist handles this.

ostrolucky avatar Aug 08 '20 09:08 ostrolucky

So not sure if we can fix this (I'm assuming the url in the response should be the "new" one, and it doesn't exist), maybe it's enough to tolerate the error?

dantleech avatar Aug 16 '20 12:08 dantleech

I mean composer did handle this properly so there must be a way. But tolerating the error might also be an option

ostrolucky avatar Aug 16 '20 12:08 ostrolucky

Also encounted this:

  webmozart/glob 3cbf63d4..06358faf
dantleech/whatchanged: ERROR: Unexpected response from Github: "{
    "message": "Moved Permanently",
    "url": "https:\/\/api.github.com\/repositories\/28594822\/compare\/3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe...06358fafde0f32edb4513f4fd88fe113a40c90ee",
    "documentation_url": "https:\/\/docs.github.com\/v3\/#http-redirects"
}

dantleech avatar Jan 31 '21 11:01 dantleech