From af8fd18aecdc294884e03b847752d5bf19922cdb Mon Sep 17 00:00:00 2001 From: mozhou52 Date: Wed, 15 Jan 2025 15:57:44 +0800 Subject: [PATCH] fix:layer support cn-heyuan-acdr-1 --- src/subCommands/layer/index.ts | 6 +++++- src/subCommands/sync/index.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/subCommands/layer/index.ts b/src/subCommands/layer/index.ts index 5daef88..80ee8ea 100644 --- a/src/subCommands/layer/index.ts +++ b/src/subCommands/layer/index.ts @@ -274,7 +274,11 @@ export default class Layer { logger.debug(`The layer code ${fileName} already exists locally, skip the download`); return fileName; } - const codeUrl = url.replace('-internal.aliyuncs.com', '.aliyuncs.com'); + let codeUrl = url; + if (process.env.FC_REGION !== this.region && this.region !== 'cn-heyuan-acdr-1'){ + codeUrl = url.replace('-internal.aliyuncs.com', '.aliyuncs.com'); + } + await downloads(codeUrl, { dest: localDir, filename: version, diff --git a/src/subCommands/sync/index.ts b/src/subCommands/sync/index.ts index f61df88..78df91e 100644 --- a/src/subCommands/sync/index.ts +++ b/src/subCommands/sync/index.ts @@ -154,7 +154,12 @@ export default class Sync { await fs_extra.removeSync(codePath); logger.debug(`clear sync code path: ${codePath}`); - await downloads(url, { + let codeUrl = url; + if (process.env.FC_REGION === this.region){ + codeUrl = url.replace('.aliyuncs.com', '-internal.aliyuncs.com'); + } + + await downloads(codeUrl, { dest: codePath, extract: true, });