diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-02-23 09:53:33 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-02-23 09:53:33 +0100 |
commit | 420ad71f69c46c40f322957a0c93f17f5618c9e2 (patch) | |
tree | 68d7b3f0281fc72a7803e2d05020298933d4b421 /importpkg.py | |
parent | d14d8f2c2b720733bd3a3a12f9c84e00e1f18fa2 (diff) | |
download | debian-dedup-420ad71f69c46c40f322957a0c93f17f5618c9e2.tar.gz |
importpkg: ignore filenames with encoding errors
Diffstat (limited to 'importpkg.py')
-rwxr-xr-x | importpkg.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/importpkg.py b/importpkg.py index 89020b9..5901b57 100755 --- a/importpkg.py +++ b/importpkg.py @@ -167,8 +167,13 @@ def process_package(db, filelike): if state != "control_file": raise ValueError("missing control file") for name, size, function, hexhash in get_hashes(tf): + try: + name = name.decode("utf8") + except UnicodeDecodeError: + print("warning: skipping filename with encoding error") + continue # skip files with non-utf8 encoding for now cur.execute("INSERT INTO content (package, filename, size, function, hash) VALUES (?, ?, ?, ?, ?);", - (package, name.decode("utf8"), size, function, hexhash)) + (package, name, size, function, hexhash)) db.commit() return raise ValueError("data.tar not found") |