mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +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://" ) ||
|
||||
foundResult.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
|
||||
( foundResult.startsWith( "http" ) && query->saveHTTPResultHint() ) )
|
||||
( TomahawkUtils::whitelistedHttpResultHint( foundResult ) && query->saveHTTPResultHint() ) )
|
||||
{
|
||||
resultHint = foundResult;
|
||||
}
|
||||
|
@@ -618,8 +618,9 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
||||
s = SourceList::instance()->getLocal();
|
||||
fileUrl = url;
|
||||
}
|
||||
else if ( !url.isEmpty() )
|
||||
else if ( TomahawkUtils::whitelistedHttpResultHint( url ) )
|
||||
{
|
||||
// Return http resulthint directly
|
||||
res = Tomahawk::Result::get( url );
|
||||
res->setRID( uuid() );
|
||||
res->setScore( 1.0 );
|
||||
@@ -632,6 +633,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
||||
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No resulthint
|
||||
return res;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#include "TomahawkUtils.moc"
|
||||
|
@@ -127,6 +127,8 @@ namespace TomahawkUtils
|
||||
// Used by the above, not exported
|
||||
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.
|
||||
* 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