@@ -30,7 +30,7 @@ export default class AttachmentManagementPlugin extends Plugin {
3030
3131 // 初始化国际化系统
3232 loadAllTranslations ( ) ;
33- const savedLanguage = this . settings . language as SupportedLanguage || detectLanguage ( ) ;
33+ const savedLanguage = ( this . settings . language as SupportedLanguage ) || detectLanguage ( ) ;
3434 setLanguage ( savedLanguage ) ;
3535 initI18n ( ) ;
3636
@@ -46,7 +46,7 @@ export default class AttachmentManagementPlugin extends Plugin {
4646 }
4747 menu . addItem ( ( item ) => {
4848 item
49- . setTitle ( t ( ' override.menuTitle' ) )
49+ . setTitle ( t ( " override.menuTitle" ) )
5050 . setIcon ( "image-plus" )
5151 . onClick ( async ( ) => {
5252 const { setting } = getOverrideSetting ( this . settings , file ) ;
@@ -142,7 +142,7 @@ export default class AttachmentManagementPlugin extends Plugin {
142142 if ( file instanceof TFile ) {
143143 if ( file . parent && isExcluded ( file . parent . path , this . settings ) ) {
144144 debugLog ( "rename - exclude path:" , file . parent . path ) ;
145- new Notice ( t ( ' notifications.fileExcluded' , { path : file . path } ) ) ;
145+ new Notice ( t ( " notifications.fileExcluded" , { path : file . path } ) ) ;
146146 return ;
147147 }
148148
@@ -160,7 +160,11 @@ export default class AttachmentManagementPlugin extends Plugin {
160160
161161 const oldMetadata = getMetadata ( oldPath ) ;
162162 // if the user have used the ${date} in `Attachment path` this could be not working, since the date will be change.
163- const oldAttachPath = oldMetadata . getAttachmentPath ( setting , this . settings . dateFormat ) ;
163+ const oldAttachPath = await oldMetadata . getAttachmentPath (
164+ setting ,
165+ this . settings . dateFormat ,
166+ this . app . vault . adapter
167+ ) ;
164168 this . app . vault . adapter . exists ( oldAttachPath , true ) . then ( ( exists ) => {
165169 if ( exists ) {
166170 checkEmptyFolder ( this . app . vault . adapter , oldAttachPath ) . then ( ( empty ) => {
@@ -194,7 +198,11 @@ export default class AttachmentManagementPlugin extends Plugin {
194198 if ( file instanceof TFile ) {
195199 const oldMetadata = getMetadata ( file . path ) ;
196200 const { setting } = getOverrideSetting ( this . settings , file ) ;
197- const oldAttachPath = oldMetadata . getAttachmentPath ( setting , this . settings . dateFormat ) ;
201+ const oldAttachPath = await oldMetadata . getAttachmentPath (
202+ setting ,
203+ this . settings . dateFormat ,
204+ this . app . vault . adapter
205+ ) ;
198206 this . app . vault . adapter . exists ( oldAttachPath , true ) . then ( ( exists ) => {
199207 if ( exists ) {
200208 checkEmptyFolder ( this . app . vault . adapter , oldAttachPath ) . then ( ( empty ) => {
@@ -231,18 +239,18 @@ export default class AttachmentManagementPlugin extends Plugin {
231239 initCommands ( ) {
232240 this . addCommand ( {
233241 id : "attachment-management-rearrange-all-links" ,
234- name : t ( ' commands.rearrangeAllLinks' ) ,
242+ name : t ( " commands.rearrangeAllLinks" ) ,
235243 callback : async ( ) => {
236244 new ConfirmModal ( this ) . open ( ) ;
237245 } ,
238246 } ) ;
239247
240248 this . addCommand ( {
241249 id : "attachment-management-rearrange-active-links" ,
242- name : t ( ' commands.rearrangeActiveLinks' ) ,
250+ name : t ( " commands.rearrangeActiveLinks" ) ,
243251 callback : async ( ) => {
244252 new ArrangeHandler ( this . settings , this . app , this ) . rearrangeAttachment ( RearrangeType . ACTIVE ) . finally ( ( ) => {
245- new Notice ( t ( ' notifications.arrangeCompleted' ) ) ;
253+ new Notice ( t ( " notifications.arrangeCompleted" ) ) ;
246254 } ) ;
247255 } ,
248256 } ) ;
@@ -275,7 +283,7 @@ export default class AttachmentManagementPlugin extends Plugin {
275283
276284 this . addCommand ( {
277285 id : "attachment-management-reset-override-setting" ,
278- name : t ( ' commands.resetOverrideSetting' ) ,
286+ name : t ( " commands.resetOverrideSetting" ) ,
279287 checkCallback : ( checking : boolean ) => {
280288 const file = getActiveFile ( this . app ) ;
281289 if ( file ) {
@@ -290,7 +298,7 @@ export default class AttachmentManagementPlugin extends Plugin {
290298 }
291299 delete this . settings . overridePath [ file . path ] ;
292300 this . saveSettings ( ) . finally ( ( ) => {
293- new Notice ( t ( ' notifications.resetAttachmentSetting' , { path : file . path } ) ) ;
301+ new Notice ( t ( " notifications.resetAttachmentSetting" , { path : file . path } ) ) ;
294302 } ) ;
295303 }
296304 return true ;
@@ -301,7 +309,7 @@ export default class AttachmentManagementPlugin extends Plugin {
301309
302310 this . addCommand ( {
303311 id : "attachment-management-clear-unused-originalname-storage" ,
304- name : t ( ' commands.clearUnusedStorage' ) ,
312+ name : t ( " commands.clearUnusedStorage" ) ,
305313 callback : async ( ) => {
306314 const attachments = await new ArrangeHandler ( this . settings , this . app , this ) . getAttachmentsInVault (
307315 this . settings ,
0 commit comments