Fix Greptile workspace review issues

This commit is contained in:
Dotta
2026-03-16 20:12:22 -05:00
parent 6dd4cc2840
commit 8d5af56fc5
4 changed files with 230 additions and 15 deletions

View File

@@ -284,6 +284,16 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
}
};
const isSafeExternalUrl = (value: string | null | undefined) => {
if (!value) return false;
try {
const parsed = new URL(value);
return parsed.protocol === "http:" || parsed.protocol === "https:";
} catch {
return false;
}
};
const formatRepoUrl = (value: string) => {
try {
const parsed = new URL(value);
@@ -539,16 +549,23 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
<div className="text-[11px] uppercase tracking-wide text-muted-foreground">Repo</div>
{codebase.repoUrl ? (
<div className="flex items-center justify-between gap-2">
<a
href={codebase.repoUrl}
target="_blank"
rel="noreferrer"
className="inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline"
>
<Github className="h-3 w-3 shrink-0" />
<span className="truncate">{formatRepoUrl(codebase.repoUrl)}</span>
<ExternalLink className="h-3 w-3 shrink-0" />
</a>
{isSafeExternalUrl(codebase.repoUrl) ? (
<a
href={codebase.repoUrl}
target="_blank"
rel="noreferrer"
className="inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline"
>
<Github className="h-3 w-3 shrink-0" />
<span className="truncate">{formatRepoUrl(codebase.repoUrl)}</span>
<ExternalLink className="h-3 w-3 shrink-0" />
</a>
) : (
<div className="inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
<Github className="h-3 w-3 shrink-0" />
<span className="truncate">{codebase.repoUrl}</span>
</div>
)}
<div className="flex items-center gap-1">
<Button
variant="outline"

View File

@@ -4,6 +4,16 @@ import { ExternalLink } from "lucide-react";
import { executionWorkspacesApi } from "../api/execution-workspaces";
import { queryKeys } from "../lib/queryKeys";
function isSafeExternalUrl(value: string | null | undefined) {
if (!value) return false;
try {
const parsed = new URL(value);
return parsed.protocol === "http:" || parsed.protocol === "https:";
} catch {
return false;
}
}
function DetailRow({ label, children }: { label: string; children: React.ReactNode }) {
return (
<div className="flex items-start gap-3 py-1.5">
@@ -52,11 +62,13 @@ export function ExecutionWorkspaceDetail() {
<span className="break-all font-mono text-xs">{workspace.providerRef ?? "None"}</span>
</DetailRow>
<DetailRow label="Repo URL">
{workspace.repoUrl ? (
{workspace.repoUrl && isSafeExternalUrl(workspace.repoUrl) ? (
<a href={workspace.repoUrl} target="_blank" rel="noreferrer" className="inline-flex items-center gap-1 hover:underline">
{workspace.repoUrl}
<ExternalLink className="h-3 w-3" />
</a>
) : workspace.repoUrl ? (
<span className="break-all font-mono text-xs">{workspace.repoUrl}</span>
) : "None"}
</DetailRow>
<DetailRow label="Opened">{new Date(workspace.openedAt).toLocaleString()}</DetailRow>