Skip to content

Commit 4afbc29

Browse files
author
高魏洪
committed
fix: Remove root directory error
1 parent 86ecf29 commit 4afbc29

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/subCommands/model/model.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ export class ModelService {
107107

108108
const processedOssMountPoints = extractOssMountDir(ossMountPoints);
109109

110+
if (
111+
storage === 'oss' &&
112+
processedOssMountPoints[0] &&
113+
(!processedOssMountPoints[0].bucketPath || processedOssMountPoints[0].bucketPath === '/')
114+
) {
115+
throw new Error(
116+
'The current deleted directory is the OSS root directory. To delete the current model, please go to the OSS console to delete the model.',
117+
);
118+
}
119+
120+
const nasPath = nasMountPoints[0].serverAddr.split(':')[1];
121+
122+
if (storage === 'nas' && nasMountPoints[0] && nasPath.trim() === '/') {
123+
throw new Error(
124+
'The current deleted directory is the NAS root directory. To delete the current model, please go to the NAS console to delete the model.',
125+
);
126+
}
110127
const fileManagerRmRequest = new $Dev20230714.FileManagerRmRequest({
111128
filepath:
112129
storage === 'nas' ? nasMountPoints[0]?.mountDir : processedOssMountPoints[0]?.mountDir,

0 commit comments

Comments
 (0)