Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Composer/packages/server/src/services/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export class BotProjectService {
throw new Error(`file ${locationRef.path} does not exist`);
}

if (!(await StorageService.checkIsBotFolder(locationRef.storageId, locationRef.path, user))) {
throw new Error(`${locationRef.path} is not a bot project folder`);
}

for (const key in BotProjectService.projectLocationMap) {
if (BotProjectService.projectLocationMap[key] === locationRef.path) {
// TODO: this should probably move to getProjectById
Expand Down
5 changes: 5 additions & 0 deletions Composer/packages/server/src/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ class StorageService {
}
};

public checkIsBotFolder = async (storageId: string, path: string, user?: UserIdentity) => {
const storageClient = this.getStorageClient(storageId, user);
return await this.isBotFolder(storageClient, path);
};

private ensureDefaultBotFoldersExist = () => {
this.storageConnections.forEach((s) => {
this.createFolderRecurively(s.defaultPath);
Expand Down