[DB] Properly handle out-of-root media files
This commit is contained in:
@@ -62,6 +62,7 @@
|
|||||||
- Add a download button to get the current playlist in a streamed zip file
|
- Add a download button to get the current playlist in a streamed zip file
|
||||||
- Add a upload button to upload media files in a dedicated directory
|
- Add a upload button to upload media files in a dedicated directory
|
||||||
- Add keyboard shortcuts
|
- Add keyboard shortcuts
|
||||||
|
- Properly handle files that have disappear from the DB (skip)
|
||||||
|
|
||||||
[Video]
|
[Video]
|
||||||
- implement a decent mediaplayer
|
- implement a decent mediaplayer
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ isFileSupported(const boost::filesystem::path& file, const std::vector<boost::fi
|
|||||||
|
|
||||||
boost::filesystem::path fileExtension = file.extension();
|
boost::filesystem::path fileExtension = file.extension();
|
||||||
|
|
||||||
for (auto extension : extensions)
|
for (auto& extension : extensions)
|
||||||
{
|
{
|
||||||
if (extension == fileExtension)
|
if (extension == fileExtension)
|
||||||
return true;
|
return true;
|
||||||
@@ -93,6 +93,22 @@ getRootDirectoriesByType(Wt::Dbo::Session& session, Database::MediaDirectory::Ty
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
isPathInParentPath(const boost::filesystem::path& path, const boost::filesystem::path& parentPath)
|
||||||
|
{
|
||||||
|
boost::filesystem::path curPath = path;
|
||||||
|
|
||||||
|
while (curPath.has_parent_path())
|
||||||
|
{
|
||||||
|
curPath = curPath.parent_path();
|
||||||
|
|
||||||
|
if (curPath == parentPath)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@@ -607,10 +623,11 @@ Updater::checkFile(const boost::filesystem::path& p, const std::vector<boost::fi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
bool foundRoot = false;
|
bool foundRoot = false;
|
||||||
for (auto rootDir : rootDirs)
|
for (auto& rootDir : rootDirs)
|
||||||
{
|
{
|
||||||
if (p.string().find( rootDir.string() ) != std::string::npos)
|
if (isPathInParentPath(p, rootDir))
|
||||||
{
|
{
|
||||||
foundRoot = true;
|
foundRoot = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user