@cloudbase/manager-node 5.9.2 → 5.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.9.3] 2026-10-27
2
+
3
+ - [Added] env: 增加 HTTP 服务路由 UpstreamResourceVersion 字段
4
+ ## [5.9.2] 2026-10-21
5
+
6
+ - [Fixed] function: COS 上传超时改为连续无进度判定,避免大包被总耗时误杀
7
+ - [Fixed] utils: 解压远程 zip 增加路径穿越防护并支持失败即中止
1
8
  ## [5.9.1] 2026-10-15
2
9
 
3
10
  - [Added] function: CBF 环境支持 PutUrl 直传函数代码包
@@ -1,6 +1,3 @@
1
- ## [5.9.1] 2026-10-15
1
+ ## [5.9.3] 2026-10-27
2
2
 
3
- - [Added] [TODO: translate] function: CBF 环境支持 PutUrl 直传函数代码包
4
- - [Added] [TODO: translate] function: 新增流量策略 V2 与版本删除接口,切换 TCB 协议
5
- - [Fixed] [TODO: translate] error: 补齐新增代码的错误 code,通过 D31 与 code 取值来源守卫
6
- - [Fixed] [TODO: translate] function: 适配 CBF 环境接口限制并补齐版本/流量与 CBF 集成测试
3
+ - [Added] [TODO: translate] env: 增加 HTTP 服务路由 UpstreamResourceVersion 字段
@@ -2017,10 +2017,15 @@ class StorageService {
2017
2017
  if (fileSize !== undefined) {
2018
2018
  headers['Content-Length'] = String(fileSize);
2019
2019
  }
2020
- if (cacheControl !== undefined && cacheControl !== null) {
2021
- headers['Cache-Control'] =
2022
- typeof cacheControl === 'number' ? `max-age=${cacheControl}` : String(cacheControl);
2023
- }
2020
+ // 未显式传入(含空白字符串)时默认 max-age=3600;注意保留 0 的语义(max-age=0)
2021
+ const normalizedCacheControl = typeof cacheControl === 'string' && cacheControl.trim() === ''
2022
+ ? undefined
2023
+ : cacheControl;
2024
+ const finalCacheControl = normalizedCacheControl !== null && normalizedCacheControl !== void 0 ? normalizedCacheControl : 3600;
2025
+ headers['Cache-Control'] =
2026
+ typeof finalCacheControl === 'number'
2027
+ ? `max-age=${finalCacheControl}`
2028
+ : String(finalCacheControl);
2024
2029
  if (metadata) {
2025
2030
  // x-metadata 放在 Header 里,具体大小限制由服务端/网关决定
2026
2031
  headers['x-metadata'] = Buffer.from(JSON.stringify(metadata), 'utf8').toString('base64');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "5.9.2",
3
+ "version": "5.9.4",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -281,6 +281,7 @@ export interface HTTPServiceRoute {
281
281
  PathRewrite?: HTTPServicePathRewrite;
282
282
  UpstreamResourceType: 'SCF' | 'CBR' | 'STATIC_STORE' | 'WEB_SCF' | 'LH' | 'STORAGE';
283
283
  UpstreamResourceName: string;
284
+ UpstreamResourceVersion?: string;
284
285
  EnableSafeDomain: boolean;
285
286
  EnableAuth: boolean;
286
287
  EnablePathTransmission: boolean;
@@ -342,6 +343,7 @@ export interface HTTPServiceRouteParam {
342
343
  Path: string;
343
344
  UpstreamResourceType?: 'SCF' | 'CBR' | 'STATIC_STORE' | 'WEB_SCF' | 'LH' | 'STORAGE';
344
345
  UpstreamResourceName?: string;
346
+ UpstreamResourceVersion?: string;
345
347
  PathRewrite?: HTTPServicePathRewrite;
346
348
  EnableSafeDomain?: boolean;
347
349
  EnableAuth?: boolean;
@@ -15,7 +15,8 @@ export interface IUploadObjectHttpOptions {
15
15
  /** 文件字节数;不传时若为 localPath/Buffer 会自动推断 */
16
16
  contentLength?: number;
17
17
  /**
18
- * 缓存控制;传 number 自动转换为 max-age=<value>,传 string 直接作为 Cache-Control 头值
18
+ * 缓存控制;传 number 自动转换为 max-age=<value>,传 string 直接作为 Cache-Control 头值。
19
+ * 不传(含空字符串)时默认 3600(即 max-age=3600);传 0 表示 max-age=0
19
20
  */
20
21
  cacheControl?: number | string;
21
22
  /** 自定义 metadata(JSON 对象),将以 Base64 编码后放入 x-metadata 头 */