@@ -21,11 +21,10 @@ import { putObjectWithVersion } from '../version/put.js';
2121import { listCommand } from '../utils/list.js' ;
2222import { hasPermission } from '../../utils/auth.js' ;
2323
24- const MAX_KEYS = 900 ;
24+ const MAX_KEYS = 2 ;
2525
2626export const copyFile = async ( config , env , daCtx , sourceKey , details , isRename ) => {
2727 const Key = `${ sourceKey . replace ( details . source , details . destination ) } ` ;
28-
2928 if ( ! hasPermission ( daCtx , sourceKey , 'read' ) || ! hasPermission ( daCtx , Key , 'write' ) ) {
3029 return {
3130 $metadata : {
@@ -81,11 +80,12 @@ export const copyFile = async (config, env, daCtx, sourceKey, details, isRename)
8180 env ,
8281 { bucket : daCtx . bucket , org : daCtx . org , key : sourceKey } ,
8382 ) ;
83+ const body = await original . body . transformToString ( ) ;
8484 return /* await */ putObjectWithVersion ( env , daCtx , {
8585 bucket : daCtx . bucket ,
8686 org : daCtx . org ,
8787 key : Key ,
88- body : original . body ,
88+ body,
8989 contentLength : original . contentLength ,
9090 type : original . contentType ,
9191 } ) ;
@@ -105,7 +105,7 @@ export const copyFile = async (config, env, daCtx, sourceKey, details, isRename)
105105 } finally {
106106 if ( Key . endsWith ( '.html' ) ) {
107107 // Reset the collab cached state for the copied object
108- await invalidateCollab ( 'syncAdmin ' , `${ daCtx . origin } /source/${ daCtx . org } /${ Key } ` , env ) ;
108+ await invalidateCollab ( 'syncadmin ' , `${ daCtx . origin } /source/${ daCtx . org } /${ Key } ` , env ) ;
109109 }
110110 }
111111} ;
0 commit comments