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:
parent
4beb521c52
commit
61aaa8938a
2 changed files with 10 additions and 4 deletions
|
|
@ -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.
|
If the path is not a host mount, you will lose your repository data when the container restarts.
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
The default path <code className="bg-muted px-1 rounded">{REPOSITORY_BASE}</code> is
|
The default path <code className="bg-muted px-1 rounded">{REPOSITORY_BASE}</code> is safe to use if you
|
||||||
safe to use if you followed the recommended Docker Compose setup.
|
followed the recommended Docker Compose setup.
|
||||||
</p>
|
</p>
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,14 @@ type Props = {
|
||||||
|
|
||||||
const getEffectiveLocalPath = (repository: Repository): string | null => {
|
const getEffectiveLocalPath = (repository: Repository): string | null => {
|
||||||
if (repository.type !== "local") return 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;
|
const basePath = config.path || REPOSITORY_BASE;
|
||||||
return `${basePath}/${config.name}`;
|
return `${basePath}/${config.name}`;
|
||||||
};
|
};
|
||||||
|
|
@ -40,7 +47,6 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => {
|
||||||
);
|
);
|
||||||
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
|
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
|
||||||
|
|
||||||
const isImportedLocal = repository.type === "local" && repository.config.isExistingRepository;
|
|
||||||
const effectiveLocalPath = getEffectiveLocalPath(repository);
|
const effectiveLocalPath = getEffectiveLocalPath(repository);
|
||||||
|
|
||||||
const updateMutation = useMutation({
|
const updateMutation = useMutation({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue