@@ -171,8 +171,9 @@ export default class AttachmentNameFormatting extends Plugin {
171
171
for ( const fileIndex in fileList ) {
172
172
progress . empty ( ) ;
173
173
progress . createEl ( "span" , {
174
- text : `Attachment renaming: ${ fileIndex + 1
175
- } /${ fileList . length } `,
174
+ text : `Attachment renaming: ${
175
+ fileIndex + 1
176
+ } /${ fileList . length } `,
176
177
} ) ;
177
178
178
179
await this . handleAttachmentNameFormatting (
@@ -304,7 +305,7 @@ export default class AttachmentNameFormatting extends Plugin {
304
305
item . link ,
305
306
file . basename ,
306
307
this . settings [
307
- fileType as keyof ANFSettings
308
+ fileType as keyof ANFSettings
308
309
] as string ,
309
310
this . settings
310
311
) &&
@@ -330,7 +331,7 @@ export default class AttachmentNameFormatting extends Plugin {
330
331
attachmentFile . path . replace (
331
332
path . extname ( attachmentFile . path ) ,
332
333
"_copy" +
333
- path . extname ( attachmentFile . path )
334
+ path . extname ( attachmentFile . path )
334
335
) ;
335
336
336
337
await this . app . vault . adapter . copy (
@@ -385,7 +386,7 @@ export default class AttachmentNameFormatting extends Plugin {
385
386
let parent_path = this . vaultAttachmentFolderPath ;
386
387
387
388
if ( parent_path === undefined ) {
388
- parent_path = '/'
389
+ parent_path = "/" ;
389
390
}
390
391
391
392
if ( parent_path . startsWith ( "./" ) ) {
@@ -398,7 +399,7 @@ export default class AttachmentNameFormatting extends Plugin {
398
399
// Fetch subfolder setting
399
400
const subfolder =
400
401
this . settings . subfolders [
401
- ATTACHMENT_TYPE . indexOf ( fileType )
402
+ ATTACHMENT_TYPE . indexOf ( fileType )
402
403
] ;
403
404
404
405
const baseNameComponent = [
@@ -466,9 +467,15 @@ export default class AttachmentNameFormatting extends Plugin {
466
467
467
468
let connectors = [ ] ;
468
469
for ( let i of optionIndex ) {
469
- connectors . push (
470
- this . settings . multipleConnectors [ i ]
471
- ) ;
470
+ if (
471
+ this . settings . multipleConnectorsEnabled [ i ]
472
+ ) {
473
+ connectors . push (
474
+ this . settings . multipleConnectors [ i ]
475
+ ) ;
476
+ } else {
477
+ connectors . push ( "" ) ;
478
+ }
472
479
}
473
480
474
481
for ( let i = 1 ; i < baseNameComponent . length ; i ++ ) {
@@ -516,7 +523,7 @@ export default class AttachmentNameFormatting extends Plugin {
516
523
destinationFile . path . substring (
517
524
0 ,
518
525
destinationFile . path . length -
519
- destinationFile . name . length
526
+ destinationFile . name . length
520
527
) ;
521
528
const tmpName =
522
529
"tmp" + Date . now ( ) + "_" + destinationFile . name ;
@@ -525,11 +532,11 @@ export default class AttachmentNameFormatting extends Plugin {
525
532
) ;
526
533
console . log (
527
534
'Rename attachment "' +
528
- destinationFile . name +
529
- '" to "' +
530
- destinationFile_path +
531
- tmpName +
532
- '"'
535
+ destinationFile . name +
536
+ '" to "' +
537
+ destinationFile_path +
538
+ tmpName +
539
+ '"'
533
540
) ;
534
541
await this . app . fileManager . renameFile (
535
542
destinationFile ,
@@ -542,10 +549,10 @@ export default class AttachmentNameFormatting extends Plugin {
542
549
) ;
543
550
console . log (
544
551
'Rename attachment "' +
545
- attachmentFile . path +
546
- '" to "' +
547
- fullName +
548
- '"'
552
+ attachmentFile . path +
553
+ '" to "' +
554
+ fullName +
555
+ '"'
549
556
) ;
550
557
551
558
const oldName = attachmentFile . name ;
@@ -599,8 +606,8 @@ export default class AttachmentNameFormatting extends Plugin {
599
606
const file_path = normalizePath (
600
607
// @ts -ignore
601
608
this . app . vault . adapter . basePath +
602
- "\\" +
603
- attachement . path
609
+ "\\" +
610
+ attachement . path
604
611
) ;
605
612
console . log ( "Get attachment" , file_path ) ;
606
613
// Get the attachment and write into JSZip instance
@@ -623,9 +630,9 @@ export default class AttachmentNameFormatting extends Plugin {
623
630
normalizePath (
624
631
// @ts -ignore
625
632
this . app . vault . adapter . basePath +
626
- "/" +
627
- file . basename +
628
- "_Attachments.zip"
633
+ "/" +
634
+ file . basename +
635
+ "_Attachments.zip"
629
636
)
630
637
)
631
638
)
@@ -695,8 +702,8 @@ export default class AttachmentNameFormatting extends Plugin {
695
702
const file_path = normalizePath (
696
703
// @ts -ignore
697
704
this . app . vault . adapter . basePath +
698
- "\\" +
699
- parseLinktext ( file . path ) . path
705
+ "\\" +
706
+ parseLinktext ( file . path ) . path
700
707
) ;
701
708
await FileSystemAdapter . readLocalFile ( file_path ) . then ( ( data ) =>
702
709
zip . file ( normalizePath ( file . name ) , data )
@@ -711,7 +718,7 @@ export default class AttachmentNameFormatting extends Plugin {
711
718
normalizePath (
712
719
// @ts -ignore
713
720
this . app . vault . adapter . basePath +
714
- "/Unused_Attachments.zip"
721
+ "/Unused_Attachments.zip"
715
722
)
716
723
)
717
724
)
0 commit comments