adds check for repo name existance and length

This commit is contained in:
Dmitry 2025-12-21 19:47:29 +07:00
parent df9f877834
commit 18722ef14f

View file

@ -76,10 +76,15 @@ const createRepository = async (name: string, config: RepositoryConfig, compress
if (config.backend === "local") {
if (config.isExistingRepository && config.path) {
const normalizedPath = path.normalize(config.path);
const repositoryName = path.basename(normalizedPath);
if (!repositoryName || repositoryName.trim().length === 0) {
throw new ConflictError("Local repository path must include a folder name.");
}
processedConfig = {
...config,
path: path.dirname(normalizedPath),
name: path.basename(normalizedPath),
name: repositoryName,
};
} else {
processedConfig = { ...config, name: shortId };