mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
fix(providers): pagination, owner listing fallback, URL and name validation
- pages stop on total/Link/empty page, not on a short page - GitHub/Gitea owner listing falls back to /user/repos (collaborator repos) and says so - url module: plain repo names, https/ssh/scp URLs on the provider host, canonical https Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b875a41b4d
commit
f1509c3d65
6 files changed
+303
-29
No files matched your search
@@ -91,10 +91,18 @@ impl Provider for GitHub {
|
||||
};
|
||||
let items = match self.http.pages(&path, 100, "per_page") {
|
||||
Ok(v) => v,
|
||||
// Not an organisation: another user's public repos.
|
||||
Err(Error::Api { status: 404, .. }) if !owner.eq_ignore_ascii_case(login) => self
|
||||
.http
|
||||
.pages(&format!("/users/{owner}/repos"), 100, "per_page")?,
|
||||
// Not an organisation (a user, or an org the token cannot see): say so, and take
|
||||
// what the token can see under that name, private repos it collaborates on included.
|
||||
Err(Error::Api { status: 404, .. }) if !owner.eq_ignore_ascii_case(login) => {
|
||||
eprintln!(
|
||||
"grove: /orgs/{owner} not found; listing the repositories you can see owned by {owner}"
|
||||
);
|
||||
self.http.pages(
|
||||
"/user/repos?affiliation=owner,collaborator,organization_member",
|
||||
100,
|
||||
"per_page",
|
||||
)?
|
||||
}
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
Ok(items
|
||||
|
||||
Reference in new issue
Block a user