fix(ui): reject malformed owner/repo strings in splitRepoFullName - #7818
Conversation
splitRepoFullName gated the free-text Repository input across 8 panels by
destructuring `[owner, repo, extra]` and rejecting only when `extra` was
truthy. That inspected just the 3rd `/`-segment, so any input whose 3rd
segment was empty slipped through as a truncated pair -- "owner/repo/",
"owner/repo//x", and pastes like "owner/repo//stale-copy" all resolved to
{owner, repo} and were silently queried instead of being rejected with the
usual "owner/repo" validation message.
Validate the segment count explicitly (`parts.length !== 2`) so anything
with more or fewer than two non-empty segments is rejected. Return shape
and all callers are unchanged.
Adds maintainer-settings-preview.test.ts (the file had no direct tests):
splitRepoFullName's valid/trailing-slash/double-slash/empty-segment cases
plus baseline coverage for the file's other exported helpers.
Closes JSONbored#7783
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-21 13:34:18 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #7783
splitRepoFullNameis the sole validity gate for the free-text Repository input across 8 panels. It destructured[owner, repo, extra]and rejected only whenextrawas truthy — which inspects just the 3rd/-segment. Any input whose 3rd segment is empty slipped through as a truncated pair:In
ams-miner-cohort-card.tsxandai-review-settings.tsxthe result feeds straight intoencodeURIComponent(owner)/encodeURIComponent(repo)to build an API path, so a pastedowner/repo//stale-copysilently queried the wrong repo instead of showing the "Enter a repository as owner/repo" validation message.Fix: validate the segment count explicitly (
parts.length !== 2) so anything with more or fewer than two non-empty segments is rejected. The return shape and every caller are unchanged.Tests: adds
maintainer-settings-preview.test.ts(the file had no direct tests despite 7 panel importers) —splitRepoFullName's valid / trailing-slash / double-slash / empty-segment / stale-copy cases, plus baseline coverage for the file's other exported helpers (splitReviewabilityPr,extractPreviewRepoOptions,parsePreviewLabels,parseLinkedIssues,findPreviewScenario,buildSettingsPreviewRequest). Verified locally: eslint + prettier clean,tsc --noEmitclean, 20/20 tests pass. (apps/loopover-uiis outside thesrc/**99% patch gate; the test file is this issue's own deliverable.)