From ab5d19bf12f831e3061c05f3fe015bf5b654c37f Mon Sep 17 00:00:00 2001 From: cp2004 <31997505+cp2004@users.noreply.github.com> Date: Sat, 14 Nov 2020 14:09:51 +0000 Subject: [PATCH] :bug: Fix uploading a language pack In Python 3, `filter()` returns an iterable rather than a list. Whilst this is better for performance, our list is not long and it means we can call `len()` on the list. Tested using reproduction steps in #3814 and verified that language packs can now be installed properly. Closes #3814 --- src/octoprint/server/api/languages.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/api/languages.py b/src/octoprint/server/api/languages.py index 68b80b5f7..8ba9a05cf 100644 --- a/src/octoprint/server/api/languages.py +++ b/src/octoprint/server/api/languages.py @@ -140,8 +140,10 @@ def uploadLanguagePack(): upload_name = request.values[input_upload_name] upload_path = request.values[input_upload_path] - exts = filter( - lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar") + exts = list( + filter( + lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar") + ) ) if not len(exts): return make_response(