Commit 9ac8e9db authored by Bart Cerneels's avatar Bart Cerneels
Browse files

Podcast dowwnload temporary names could be to long.

Fixed by using MD5 hash as the name instead.
Patch by Frank Steinmetzger.

BUG:264813
REVIEW:100487
parent 797f2c3c
......@@ -20,6 +20,8 @@ VERSION 2.4.1
<bhargav.1191@gmail.com>. (BR 248690)
BUGFIXES:
* Fixed temporary podcast download filenames that were to long by using MD5 hash instead.
Thanks to Frank Steinmetzger for the patch. (BR 264813)
* Fixed issue with absentee toolbar on clear run (without config files). (BR 259615)
* Fixed CD copying functionality. (BR 264050)
* Fixed CUE tracks playback order. (BR 263237)
......
......@@ -35,6 +35,7 @@
#include "ui_SqlPodcastProviderSettingsWidget.h"
#include <KCodecs>
#include <KLocale>
#include <KFileDialog>
#include <KIO/CopyJob>
......@@ -1237,7 +1238,7 @@ SqlPodcastProvider::downloadEpisode( Podcasts::SqlPodcastEpisodePtr sqlEpisode )
QFile *tmpFile = createTmpFile( sqlEpisode );
struct PodcastEpisodeDownload download = { sqlEpisode,
tmpFile,
/* Unless a reidrect happens the filename from the enclosure is used. This is a potential source
/* Unless a redirect happens the filename from the enclosure is used. This is a potential source
of filename conflicts in downloadResult() */
KUrl( sqlEpisode->uidUrl() ).fileName(),
false
......@@ -1321,6 +1322,7 @@ SqlPodcastProvider::createTmpFile( Podcasts::SqlPodcastEpisodePtr sqlEpisode )
QDir dir( sqlChannel->saveLocation().toLocalFile() );
dir.mkpath( "." ); // ensure that the path is there
//TODO: what if result is false?
KUrl localUrl = KUrl::fromPath( dir.absolutePath() );
QString tempName;
......@@ -1328,7 +1330,10 @@ SqlPodcastProvider::createTmpFile( Podcasts::SqlPodcastEpisodePtr sqlEpisode )
tempName = QUrl::toPercentEncoding( sqlEpisode->guid() );
else
tempName = QUrl::toPercentEncoding( sqlEpisode->uidUrl() );
localUrl.addPath( tempName + PODCAST_TMP_POSTFIX );
QString tempNameMd5( KMD5( tempName.toUtf8() ).hexDigest() );
localUrl.addPath( tempNameMd5 + PODCAST_TMP_POSTFIX );
return new QFile( localUrl.toLocalFile() );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment