fix: 修复应用键生成逻辑,确保键值不以斜杠开头
This commit is contained in:
@@ -13,7 +13,11 @@ const createRandomApp = (opts: { app: any, package: any, pwd: string, status?: s
|
|||||||
}
|
}
|
||||||
if (!app.key) {
|
if (!app.key) {
|
||||||
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
||||||
app.key = packageJson.basename || `${'unknown-app'}-${randomSuffix}`;
|
let appKey: string = packageJson.basename || `${'unknown-app'}-${randomSuffix}`;
|
||||||
|
if (appKey.startsWith('/')) {
|
||||||
|
appKey = appKey.slice(1)
|
||||||
|
}
|
||||||
|
app.key = appKey;
|
||||||
}
|
}
|
||||||
app.path = pwd;
|
app.path = pwd;
|
||||||
if (app.type === 'pm2-system-app' && !app.pm2Options) {
|
if (app.type === 'pm2-system-app' && !app.pm2Options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user