mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Slack import: Use Python ZipFile to unzip.
This should handle the case when non-ASCII Unicode folder names are created on Windows. Fixes #19899.
This commit is contained in:
		@@ -4,6 +4,7 @@ import random
 | 
				
			|||||||
import secrets
 | 
					import secrets
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
 | 
					import zipfile
 | 
				
			||||||
from collections import defaultdict
 | 
					from collections import defaultdict
 | 
				
			||||||
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Type, TypeVar
 | 
					from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Type, TypeVar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1290,7 +1291,8 @@ def do_convert_data(original_path: str, output_dir: str, token: str, threads: in
 | 
				
			|||||||
        if not os.path.exists(slack_data_dir):
 | 
					        if not os.path.exists(slack_data_dir):
 | 
				
			||||||
            os.makedirs(slack_data_dir)
 | 
					            os.makedirs(slack_data_dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        subprocess.check_call(["unzip", "-q", original_path, "-d", slack_data_dir])
 | 
					        with zipfile.ZipFile(original_path) as zipObj:
 | 
				
			||||||
 | 
					            zipObj.extractall(slack_data_dir)
 | 
				
			||||||
    elif os.path.isdir(original_path):
 | 
					    elif os.path.isdir(original_path):
 | 
				
			||||||
        slack_data_dir = original_path
 | 
					        slack_data_dir = original_path
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user