KnpLabs / KnpLabs/php-github-api

Invalid url for get reference endpoint?

Aperta
#1,037 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
PHP
Stelle
2.2k
Fork
585
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

While this code works fine for most use cases:

https://github.com/KnpLabs/php-github-api/blob/de2f27846139e7b4b92dcad9ff77660d0dc5dfad/lib/Github/Api/GitData/References.php#L83

It looks like that GET /refs/{ref} is an undocumented endpoint and it returns an array of references when an exact reference is not found, but other similar references are found in the repo.

Current GitHub docs tells to use GET /ref/{ref} URL: https://docs.github.com/en/rest/reference/git#get-a-reference

My story: I have the following references in the repo:

  • accepted-1-1
  • accepted-1-1-1

When I try to get accepted-1 reference using references()->show(..) I get the following response, but I expect zero results:

Screenshot 2021-11-11 at 22 15 41

If I change GET /refs/{ref} to GET /ref/{ref} in References.php it starts throwing a 404 not found exception as expected.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in lib/Github/Api/GitData/References.php alla riga indicata e confronta il percorso richiesto con la documentazione corrente di get-a-reference di GitHub. Riproduci la ricerca di un riferimento parziale e verifica che un riferimento esatto inesistente non restituisca più riferimenti con nomi simili; aggiorna il comportamento pertinente e aggiungi o modifica la copertura dove i test esistenti del repository coprono questo endpoint.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github, php
Ambito
api
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.