mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 09:25:36 -04:00
squashme WIP upload log to paste server - more error checks and validations
This commit is contained in:
parent
e096631c54
commit
c90d3b2016
1 changed files with 15 additions and 4 deletions
|
@ -35,7 +35,9 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
@ -288,12 +290,21 @@ quint16 fichePort = 9999; // TODO: config var
|
||||||
|
|
||||||
cDebug() << "Reading response from paste server";
|
cDebug() << "Reading response from paste server";
|
||||||
|
|
||||||
char resp[1024];
|
char resp[1024]; resp[0] = '\0';
|
||||||
socket->readLine(resp, 1024);
|
qint64 nBytesRead = socket->readLine(resp, 1024);
|
||||||
socket->close();
|
socket->close();
|
||||||
|
|
||||||
QString pasteUrl = QString( resp ) ;
|
QUrl pasteUrl = QUrl( QString( resp ).trimmed(), QUrl::StrictMode );
|
||||||
QString pasteUrlMsg = QString( pasteUrlFmt ).arg( pasteUrl );
|
QString pasteUrlStr = pasteUrl.toString() ;
|
||||||
|
QRegularExpression pasteUrlRegex( "^http[s]?://" + ficheHost );
|
||||||
|
QString pasteUrlMsg = QString( pasteUrlFmt ).arg( pasteUrlStr );
|
||||||
|
|
||||||
|
if ( nBytesRead < 8 || !pasteUrl.isValid() ||
|
||||||
|
!pasteUrlRegex.match( pasteUrlStr ).hasMatch() )
|
||||||
|
{
|
||||||
|
cError() << "No data from paste server";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cDebug() << pasteUrlMsg;
|
cDebug() << pasteUrlMsg;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue