Commit 1d2f2d99 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

FsDiscoverer: Properly handle a discovery request of a blacklisted folder

parent 912279cf
......@@ -70,7 +70,15 @@ bool FsDiscoverer::discover( const std::string &entryPoint )
return true;
if ( hasDotNoMediaFile( *fsDir ) )
return true;
return addFolder( *fsDir, nullptr );
try
{
return addFolder( *fsDir, nullptr );
}
catch ( sqlite::errors::ConstraintViolation& ex )
{
LOG_WARN( entryPoint, " discovery aborted (assuming blacklisted folder): ", ex.what() );
}
return true;
}
bool FsDiscoverer::reload()
......
......@@ -290,6 +290,18 @@ TEST_F( FoldersNoDiscover, Blacklist )
ASSERT_EQ( nullptr, f );
}
TEST_F( FoldersNoDiscover, DiscoverBlacklisted )
{
cbMock->prepareForWait();
ml->banFolder( mock::FileSystemFactory::Root );
ml->discover( mock::FileSystemFactory::Root );
bool discovered = cbMock->wait();
ASSERT_TRUE( discovered );
auto f = ml->folder( mock::FileSystemFactory::Root );
ASSERT_EQ( nullptr, f );
}
TEST_F( Folders, BlacklistAfterDiscovery )
{
auto f = ml->folder( mock::FileSystemFactory::SubFolder );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment