mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-23 16:01:43 +01:00
Calculate chunkcount with the real file size, not the size saved in the database (might be wrong and results in corrupted download).
(cherry picked from commit 42d9a86ff0
)
This commit is contained in:
parent
313ecbc783
commit
3a8a88972f
@ -628,10 +628,6 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
if (!(song.url().scheme() == "file"))
|
||||
return;
|
||||
|
||||
// Calculate the number of chunks
|
||||
int chunk_count = qRound((song.filesize() / kFileChunkSize) + 0.5);
|
||||
int chunk_number = 1;
|
||||
|
||||
// Open the file
|
||||
QFile file(song.url().toLocalFile());
|
||||
file.open(QIODevice::ReadOnly);
|
||||
@ -643,6 +639,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
|
||||
QImage null_image;
|
||||
|
||||
// Calculate the number of chunks
|
||||
int chunk_count = qRound((file.size() / kFileChunkSize) + 0.5);
|
||||
int chunk_number = 1;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
// Read file chunk
|
||||
data = file.read(kFileChunkSize);
|
||||
|
Loading…
Reference in New Issue
Block a user