fix: import local repository with selected path
This commit is contained in:
parent
fc04cfe02e
commit
df9f877834
1 changed files with 11 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
|
import path from "node:path";
|
||||||
import { and, eq, ne } from "drizzle-orm";
|
import { and, eq, ne } from "drizzle-orm";
|
||||||
import { ConflictError, InternalServerError, NotFoundError } from "http-errors-enhanced";
|
import { ConflictError, InternalServerError, NotFoundError } from "http-errors-enhanced";
|
||||||
import slugify from "slugify";
|
import slugify from "slugify";
|
||||||
|
|
@ -73,7 +74,16 @@ const createRepository = async (name: string, config: RepositoryConfig, compress
|
||||||
|
|
||||||
let processedConfig = config;
|
let processedConfig = config;
|
||||||
if (config.backend === "local") {
|
if (config.backend === "local") {
|
||||||
processedConfig = { ...config, name: shortId };
|
if (config.isExistingRepository && config.path) {
|
||||||
|
const normalizedPath = path.normalize(config.path);
|
||||||
|
processedConfig = {
|
||||||
|
...config,
|
||||||
|
path: path.dirname(normalizedPath),
|
||||||
|
name: path.basename(normalizedPath),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
processedConfig = { ...config, name: shortId };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const encryptedConfig = await encryptConfig(processedConfig);
|
const encryptedConfig = await encryptConfig(processedConfig);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue