[game-data-packager] 01/02: download: skip files where size doesn't match what is expected

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sun Jan 24 21:10:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 6a1365d348d8917abe5051290e0cd62365d86b5a
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun Jan 24 22:06:31 2016 +0100

    download: skip files where size doesn't match what is expected
---
 game_data_packager/build.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index f321630..bf51150 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -766,6 +766,16 @@ class PackagingTask(object):
                         if rf is None:
                             continue
 
+                        try:
+                            size = int(rf.info().get('Content-Length'))
+                        except:
+                            size = None
+                        if size and size != wanted.size:
+                            logger.warning("File doesn't have expected size"
+                                           " (%s vs %s), skipping %s",
+                                           size, wanted.size, url)
+                            continue
+
                         if self.save_downloads is not None:
                             tmp = os.path.join(self.save_downloads,
                                     wanted.name)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list