[libcalamaresui] Drop RE-wrangling, compare hosts instead to detect valid paste URL

main
Adriaan de Groot 4 years ago
parent 8af5fb5da5
commit f72436aa0a

@ -15,7 +15,6 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QFile> #include <QFile>
#include <QRegularExpression>
#include <QStringList> #include <QStringList>
#include <QTcpSocket> #include <QTcpSocket>
#include <QUrl> #include <QUrl>
@ -95,12 +94,11 @@ ficheLogUpload( QObject* parent )
QUrl pasteUrl = QUrl( QString( responseText ).trimmed(), QUrl::StrictMode ); QUrl pasteUrl = QUrl( QString( responseText ).trimmed(), QUrl::StrictMode );
QString pasteUrlStr = pasteUrl.toString(); QString pasteUrlStr = pasteUrl.toString();
QRegularExpression pasteUrlRegex( "^http[s]?://" + ficheHost );
QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" ); QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" );
QString pasteUrlMsg = pasteUrlFmt.arg( pasteUrlStr ); QString pasteUrlMsg = pasteUrlFmt.arg( pasteUrlStr );
if ( pasteUrl.isValid() && pasteUrlRegex.match( pasteUrlStr ).hasMatch() ) if ( pasteUrl.isValid() && pasteUrl.host() == ficheHost )
{ {
QClipboard* clipboard = QApplication::clipboard(); QClipboard* clipboard = QApplication::clipboard();
clipboard->setText( pasteUrlStr, QClipboard::Clipboard ); clipboard->setText( pasteUrlStr, QClipboard::Clipboard );

Loading…
Cancel
Save