@@ -526,6 +526,47 @@ describe('/libraries', () => {
526526 utils . removeImageFile ( `${ testAssetDir } /temp/reimport/asset.jpg` ) ;
527527 } ) ;
528528
529+ it ( 'should not reimport a modified file more than once' , async ( ) => {
530+ const library = await utils . createLibrary ( admin . accessToken , {
531+ ownerId : admin . userId ,
532+ importPaths : [ `${ testAssetDirInternal } /temp/reimport` ] ,
533+ } ) ;
534+
535+ utils . createImageFile ( `${ testAssetDir } /temp/reimport/asset.jpg` ) ;
536+ await utimes ( `${ testAssetDir } /temp/reimport/asset.jpg` , 447_775_200_000 ) ;
537+
538+ await utils . scan ( admin . accessToken , library . id ) ;
539+
540+ cpSync ( `${ testAssetDir } /albums/nature/tanners_ridge.jpg` , `${ testAssetDir } /temp/reimport/asset.jpg` ) ;
541+ await utimes ( `${ testAssetDir } /temp/reimport/asset.jpg` , 447_775_200_001 ) ;
542+
543+ await utils . scan ( admin . accessToken , library . id ) ;
544+
545+ cpSync ( `${ testAssetDir } /albums/nature/el_torcal_rocks.jpg` , `${ testAssetDir } /temp/reimport/asset.jpg` ) ;
546+ await utimes ( `${ testAssetDir } /temp/reimport/asset.jpg` , 447_775_200_001 ) ;
547+
548+ await utils . scan ( admin . accessToken , library . id ) ;
549+
550+ const { assets } = await utils . searchAssets ( admin . accessToken , {
551+ libraryId : library . id ,
552+ } ) ;
553+
554+ expect ( assets . count ) . toEqual ( 1 ) ;
555+
556+ const asset = await utils . getAssetInfo ( admin . accessToken , assets . items [ 0 ] . id ) ;
557+
558+ expect ( asset ) . toEqual (
559+ expect . objectContaining ( {
560+ originalFileName : 'asset.jpg' ,
561+ exifInfo : expect . objectContaining ( {
562+ model : 'NIKON D750' ,
563+ } ) ,
564+ } ) ,
565+ ) ;
566+
567+ utils . removeImageFile ( `${ testAssetDir } /temp/reimport/asset.jpg` ) ;
568+ } ) ;
569+
529570 it ( 'should set an asset offline if its file is missing' , async ( ) => {
530571 const library = await utils . createLibrary ( admin . accessToken , {
531572 ownerId : admin . userId ,
0 commit comments