diff --git a/internal/cli/target.go b/internal/cli/target.go index 6cd3a46..45a2089 100644 --- a/internal/cli/target.go +++ b/internal/cli/target.go @@ -10,7 +10,7 @@ import ( func parseHandleRepo(arg string) (string, string, error) { parts := strings.SplitN(arg, "/", 2) - if len(parts) != 2 || parts[0] == "" || parts[1] == "" { + if len(parts) != 2 || parts[0] == "" || parts[1] == "" || strings.Contains(parts[1], "/") { return "", "", fmt.Errorf("expected handle/repo, got %q", arg) } return parts[0], parts[1], nil diff --git a/internal/cli/target_test.go b/internal/cli/target_test.go index 2391dc8..66d6dc6 100644 --- a/internal/cli/target_test.go +++ b/internal/cli/target_test.go @@ -12,7 +12,8 @@ func TestParseHandleRepo(t *testing.T) { }{ {name: "handle and repo", arg: "aly.codes/tg", wantHandle: "aly.codes", wantRepo: "tg"}, {name: "did handle", arg: "did:plc:abc123/tg", wantHandle: "did:plc:abc123", wantRepo: "tg"}, - {name: "repo containing slash", arg: "aly.codes/a/b", wantHandle: "aly.codes", wantRepo: "a/b"}, + // Repo names become atproto record keys, which cannot contain "/". + {name: "repo containing slash", arg: "aly.codes/a/b", wantErr: true}, {name: "no slash", arg: "tg", wantErr: true}, {name: "empty handle", arg: "/tg", wantErr: true}, {name: "empty repo", arg: "aly.codes/", wantErr: true},