From 19db2fa773a77fa9207f3a05450e0a1d3d7a1f70 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 27 May 2021 18:12:23 -0700 Subject: [PATCH] import_data: Do some quick verification of Slack import formats. --- zerver/data_import/slack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py index ff9301ca36..8d067b9dcd 100755 --- a/zerver/data_import/slack.py +++ b/zerver/data_import/slack.py @@ -1293,6 +1293,9 @@ def do_convert_data(slack_zip_file: str, output_dir: str, token: str, threads: i subprocess.check_call(["unzip", "-q", slack_zip_file, "-d", slack_data_dir]) + if not os.path.isfile(os.path.join(slack_data_dir, "channels.json")): + raise ValueError(f"{original_path} does not have the layout we expect from a Slack export!") + # We get the user data from the legacy token method of Slack API, which is depreciated # but we use it as the user email data is provided only in this method user_list = get_slack_api_data("https://slack.com/api/users.list", "members", token=token)