Skip to content

Refuse a repo name that is not an owner/repo String in repo_id_by_name - #1313

Open
Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1228
Open

Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1228

Conversation

@Thayorns

Copy link
Copy Markdown
Contributor

repo_id_by_name checked its argument only for nil. A name without a slash, or an empty one, reached Octokit and came back as a raw Octokit::InvalidRepository, and an Integer went straight to GET /repositories/:id, as #1228 shows. Its sibling repo_name_by_id already refuses a value of the wrong type with Fbe::Error.

Now repo_id_by_name raises Fbe::Error, naming the value, unless it is a String with exactly one slash and something on both sides of it. The check runs before any request.

The tests cover a random name without a slash, an empty name, an Integer, a name with two slashes, one without the owner and one without the repository, all on the fake client, and the slash-less name from the issue on the real Octokit client through WebMock.

Closes #1228

@Thayorns

Copy link
Copy Markdown
Contributor Author

@yegor256 take a look please, happy to clarify anything about this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo_id_by_name raises a raw Octokit::InvalidRepository for a name without a slash, instead of Fbe::Error

1 participant