Skip to content

Commit

Permalink
Merge pull request #37 from czlitony/handle_download_error
Browse files Browse the repository at this point in the history
Handle download error
  • Loading branch information
alex-spataru authored Sep 24, 2023
2 parents 14c1bef + 8d5b0fd commit 2a06879
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ void Downloader::setUserAgentString(const QString &agent)

void Downloader::finished()
{
if (m_reply->error() != QNetworkReply::NoError)
{
QFile::remove(m_downloadDir.filePath(m_fileName + PARTIAL_DOWN));
return;
}

/* Rename file */
QFile::rename(m_downloadDir.filePath(m_fileName + PARTIAL_DOWN), m_downloadDir.filePath(m_fileName));

Expand Down

0 comments on commit 2a06879

Please sign in to comment.