You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2022/07/19 11:41:47 UTC

[lucene-jira-archive] 02/02: don't create empty file for moved issues

This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a commit to branch check-issue-key-when-downloading
in repository https://gitbox.apache.org/repos/asf/lucene-jira-archive.git

commit b7f90891dc918a87e886e2926199393fb9421420
Author: Tomoko Uchida <to...@gmail.com>
AuthorDate: Tue Jul 19 20:41:34 2022 +0900

    don't create empty file for moved issues
---
 migration/src/download_jira.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/migration/src/download_jira.py b/migration/src/download_jira.py
index 648c25e8..dbe5bac9 100644
--- a/migration/src/download_jira.py
+++ b/migration/src/download_jira.py
@@ -41,12 +41,12 @@ def download_issue(num: int, dump_dir: Path) -> bool:
     if res.status_code != 200:
         logger.warning(f"Can't download {issue_id}. status code={res.status_code}, message={res.text}")
         return False
+    data = res.json()
+    if data["key"] != issue_id:
+        logger.warning(f"The issue key {data['key']} does not match the request key {issue_id}. Maybe this was moved.")
+        return False
     dump_file = jira_dump_file(dump_dir, num)
     with open(dump_file, "w") as fp:
-        data = res.json()
-        if data["key"] != issue_id:
-            logger.warning(f"The issue key {data['key']} does not match the request key {issue_id}. Maybe this was moved.")
-            return False
         json.dump(data, fp, indent=2)
     logger.debug(f"Jira issue {issue_id} was downloaded in {dump_file}.")
     return True