hatstand code review update 1
This commit is contained in:
parent
114802a0ca
commit
41513527cd
|
@ -446,24 +446,28 @@ void IncomingDataParser::AppendFilesToPlaylist(const pb::remote::Message& msg) {
|
|||
if (relative_path.startsWith("/")) relative_path.remove(0, 1);
|
||||
|
||||
QFileInfo fi_folder(root_dir, relative_path);
|
||||
if (!fi_folder.exists())
|
||||
if (!fi_folder.exists()) {
|
||||
qLog(Warning) << "Remote relative path " << relative_path
|
||||
<< " doesn't exist...";
|
||||
else if (!fi_folder.isDir())
|
||||
return;
|
||||
} else if (!fi_folder.isDir()) {
|
||||
qLog(Warning) << "Remote relative path " << relative_path
|
||||
<< " is not a directory...";
|
||||
else if (root_dir.relativeFilePath(fi_folder.absoluteFilePath())
|
||||
.startsWith("../"))
|
||||
return;
|
||||
} else if (root_dir.relativeFilePath(fi_folder.absoluteFilePath())
|
||||
.startsWith("../")) {
|
||||
qLog(Warning) << "Remote relative path " << relative_path
|
||||
<< " should not be accessed...";
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QUrl> urls;
|
||||
QDir dir(fi_folder.absoluteFilePath());
|
||||
for (const auto& file : req_append.files()) {
|
||||
QFileInfo fi(dir, file.c_str());
|
||||
if (fi.exists()) urls << QUrl::fromLocalFile(fi.canonicalFilePath());
|
||||
}
|
||||
if (urls.size()) {
|
||||
if (!urls.isEmpty()) {
|
||||
MimeData* data = new MimeData;
|
||||
data->setUrls(urls);
|
||||
if (req_append.has_play_now()) data->play_now_ = req_append.play_now();
|
||||
|
@ -486,5 +490,4 @@ void IncomingDataParser::AppendFilesToPlaylist(const pb::remote::Message& msg) {
|
|||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ void OutgoingDataCreator::SendClementineInfo() {
|
|||
|
||||
// allowed extensions for REQUEST_FILES and LIST_FILES
|
||||
for (const QString& ext : files_music_extensions_)
|
||||
*info->add_files_music_extensions() = ext.toStdString();
|
||||
info->add_files_music_extensions(ext.toStdString());
|
||||
|
||||
QString version =
|
||||
QString("%1 %2").arg(QCoreApplication::applicationName(),
|
||||
|
|
Loading…
Reference in New Issue