fix: handle imported repositories correctly in getEffectiveLocalPath

- Imported repositories use config.path directly (matching server logic)
- Removed unused isImportedLocal variable
This commit is contained in:
Jakub Trávník 2026-01-03 12:47:03 +01:00
parent affe0a45fa
commit 2d6c9397c0
2 changed files with 10 additions and 4 deletions

View file

@ -54,8 +54,8 @@ export const LocalRepositoryForm = ({ form }: Props) => {
If the path is not a host mount, you will lose your repository data when the container restarts.
</p>
<p className="text-sm text-muted-foreground">
The default path <code className="bg-muted px-1 rounded">{REPOSITORY_BASE}</code> is
safe to use if you followed the recommended Docker Compose setup.
The default path <code className="bg-muted px-1 rounded">{REPOSITORY_BASE}</code> is safe to use if you
followed the recommended Docker Compose setup.
</p>
</AlertDialogDescription>
</AlertDialogHeader>

View file

@ -28,7 +28,14 @@ type Props = {
const getEffectiveLocalPath = (repository: Repository): string | null => {
if (repository.type !== "local") return null;
const config = repository.config as { name: string; path?: string };
const config = repository.config as { name: string; path?: string; isExistingRepository?: boolean };
if (config.isExistingRepository) {
// Imported repositories use the path directly
return config.path ?? null;
}
// New repositories append the name to the base path
const basePath = config.path || REPOSITORY_BASE;
return `${basePath}/${config.name}`;
};
@ -40,7 +47,6 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => {
);
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
const isImportedLocal = repository.type === "local" && repository.config.isExistingRepository;
const effectiveLocalPath = getEffectiveLocalPath(repository);
const updateMutation = useMutation({