@@ -43,9 +43,9 @@ export async function getUploadUrl(config: Config, token: string): Promise<strin
4343 * @param key 目标文件名
4444 * @param uploadInfo 上传信息
4545 */
46- function getBaseUrl ( bucket : string , key : string , uploadInfo : UploadInfo ) {
46+ function getBaseUrl ( bucket : string , key : string | null | undefined , uploadInfo : UploadInfo ) {
4747 const { url, id } = uploadInfo
48- return `${ url } /buckets/${ bucket } /objects/${ urlSafeBase64Encode ( key ) } /uploads/${ id } `
48+ return `${ url } /buckets/${ bucket } /objects/${ key != null ? urlSafeBase64Encode ( key ) : '~' } /uploads/${ id } `
4949}
5050
5151export interface InitPartsData {
@@ -64,10 +64,10 @@ export interface InitPartsData {
6464export function initUploadParts (
6565 token : string ,
6666 bucket : string ,
67- key : string ,
67+ key : string | null | undefined ,
6868 uploadUrl : string
6969) : utils . Response < InitPartsData > {
70- const url = `${ uploadUrl } /buckets/${ bucket } /objects/${ urlSafeBase64Encode ( key ) } /uploads`
70+ const url = `${ uploadUrl } /buckets/${ bucket } /objects/${ key != null ? urlSafeBase64Encode ( key ) : '~' } /uploads`
7171 return utils . request < InitPartsData > (
7272 url ,
7373 {
@@ -90,7 +90,7 @@ export interface UploadChunkData {
9090 */
9191export function uploadChunk (
9292 token : string ,
93- key : string ,
93+ key : string | null | undefined ,
9494 index : number ,
9595 uploadInfo : UploadInfo ,
9696 options : Partial < utils . RequestOptions >
@@ -114,7 +114,7 @@ export type UploadCompleteData = any
114114 */
115115export function uploadComplete (
116116 token : string ,
117- key : string ,
117+ key : string | null | undefined ,
118118 uploadInfo : UploadInfo ,
119119 options : Partial < utils . RequestOptions >
120120) : utils . Response < UploadCompleteData > {
@@ -134,7 +134,7 @@ export function uploadComplete(
134134 */
135135export function deleteUploadedChunks (
136136 token : string ,
137- key : string ,
137+ key : string | null | undefined ,
138138 uploadinfo : UploadInfo
139139) : utils . Response < void > {
140140 const bucket = utils . getPutPolicy ( token ) . bucket
0 commit comments