@@ -128,7 +128,11 @@ export default class UploadPlugin extends AdminForthPlugin {
128128 if ( record [ pathColumnName ] ) {
129129 process . env . HEAVY_DEBUG && console . log ( '🪥🪥 remove ObjectTagging' , record [ pathColumnName ] ) ;
130130 // let it crash if it fails: this is a new file which just was uploaded.
131- await this . options . storageAdapter . markKeyForNotDeletation ( record [ pathColumnName ] ) ;
131+ if ( this . options . storageAdapter . markKeyForNotDeletion !== undefined ) {
132+ await this . options . storageAdapter . markKeyForNotDeletion ( record [ pathColumnName ] ) ;
133+ } else {
134+ await this . options . storageAdapter . markKeyForNotDeletation ( record [ pathColumnName ] ) ;
135+ }
132136 }
133137 return { ok : true } ;
134138 } ) ;
@@ -171,7 +175,11 @@ export default class UploadPlugin extends AdminForthPlugin {
171175 resourceConfig . hooks . delete . afterSave . push ( async ( { record } : { record : any } ) => {
172176 if ( record [ pathColumnName ] ) {
173177 try {
174- await this . options . storageAdapter . markKeyForDeletation ( record [ pathColumnName ] ) ;
178+ if ( this . options . storageAdapter . markKeyForDeletion !== undefined ) {
179+ await this . options . storageAdapter . markKeyForDeletion ( record [ pathColumnName ] ) ;
180+ } else {
181+ await this . options . storageAdapter . markKeyForDeletation ( record [ pathColumnName ] ) ;
182+ }
175183 } catch ( e ) {
176184 // file might be e.g. already deleted, so we catch error
177185 console . error ( `Error setting tag ${ ADMINFORTH_NOT_YET_USED_TAG } to true for object ${ record [ pathColumnName ] } . File will not be auto-cleaned up` , e ) ;
@@ -192,7 +200,11 @@ export default class UploadPlugin extends AdminForthPlugin {
192200 if ( oldRecord [ pathColumnName ] ) {
193201 // put tag to delete old file
194202 try {
195- await this . options . storageAdapter . markKeyForDeletation ( oldRecord [ pathColumnName ] ) ;
203+ if ( this . options . storageAdapter . markKeyForDeletion !== undefined ) {
204+ await this . options . storageAdapter . markKeyForDeletion ( oldRecord [ pathColumnName ] ) ;
205+ } else {
206+ await this . options . storageAdapter . markKeyForDeletation ( oldRecord [ pathColumnName ] ) ;
207+ }
196208 } catch ( e ) {
197209 // file might be e.g. already deleted, so we catch error
198210 console . error ( `Error setting tag ${ ADMINFORTH_NOT_YET_USED_TAG } to true for object ${ oldRecord [ pathColumnName ] } . File will not be auto-cleaned up` , e ) ;
@@ -201,8 +213,12 @@ export default class UploadPlugin extends AdminForthPlugin {
201213 if ( updates [ pathColumnName ] !== null ) {
202214 // remove tag from new file
203215 // in this case we let it crash if it fails: this is a new file which just was uploaded.
216+ if ( this . options . storageAdapter . markKeyForNotDeletion !== undefined ) {
217+ await this . options . storageAdapter . markKeyForNotDeletion ( updates [ pathColumnName ] ) ;
218+ } else {
204219 await this . options . storageAdapter . markKeyForNotDeletation ( updates [ pathColumnName ] ) ;
205220 }
221+ }
206222 }
207223 return { ok : true } ;
208224 } ) ;
0 commit comments