mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Only accept http urls for resulthints
This commit is contained in:
@@ -280,7 +280,7 @@ DatabaseCommand_SetPlaylistRevision::hintFromQuery( const query_ptr& query ) con
|
|||||||
|
|
||||||
if ( foundResult.startsWith( "file://" ) ||
|
if ( foundResult.startsWith( "file://" ) ||
|
||||||
foundResult.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
|
foundResult.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
|
||||||
( foundResult.startsWith( "http" ) && query->saveHTTPResultHint() ) )
|
( TomahawkUtils::whitelistedHttpResultHint( foundResult ) && query->saveHTTPResultHint() ) )
|
||||||
{
|
{
|
||||||
resultHint = foundResult;
|
resultHint = foundResult;
|
||||||
}
|
}
|
||||||
|
@@ -618,8 +618,9 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
s = SourceList::instance()->getLocal();
|
s = SourceList::instance()->getLocal();
|
||||||
fileUrl = url;
|
fileUrl = url;
|
||||||
}
|
}
|
||||||
else if ( !url.isEmpty() )
|
else if ( TomahawkUtils::whitelistedHttpResultHint( url ) )
|
||||||
{
|
{
|
||||||
|
// Return http resulthint directly
|
||||||
res = Tomahawk::Result::get( url );
|
res = Tomahawk::Result::get( url );
|
||||||
res->setRID( uuid() );
|
res->setRID( uuid() );
|
||||||
res->setScore( 1.0 );
|
res->setScore( 1.0 );
|
||||||
@@ -632,6 +633,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No resulthint
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
bool searchlocal = s->isLocal();
|
bool searchlocal = s->isLocal();
|
||||||
|
|
||||||
|
@@ -941,6 +941,14 @@ extractBinaryResolver( const QString& zipFilename, QObject* receiver )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
whitelistedHttpResultHint( const QString& url )
|
||||||
|
{
|
||||||
|
// For now, just http/https
|
||||||
|
return url.startsWith( "http" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
#include "TomahawkUtils.moc"
|
#include "TomahawkUtils.moc"
|
||||||
|
@@ -127,6 +127,8 @@ namespace TomahawkUtils
|
|||||||
// Used by the above, not exported
|
// Used by the above, not exported
|
||||||
void copyWithAuthentication( const QString& srcFile, const QDir dest, QObject* receiver );
|
void copyWithAuthentication( const QString& srcFile, const QDir dest, QObject* receiver );
|
||||||
|
|
||||||
|
DLLEXPORT bool whitelistedHttpResultHint( const QString& url );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This helper is designed to help "update" an existing playlist with a newer revision of itself.
|
* This helper is designed to help "update" an existing playlist with a newer revision of itself.
|
||||||
* To avoid re-loading the whole playlist and re-resolving tracks that are the same in the old playlist,
|
* To avoid re-loading the whole playlist and re-resolving tracks that are the same in the old playlist,
|
||||||
|
Reference in New Issue
Block a user