mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 06:33:35 +08:00 
			
		
		
		
	bytesio
This commit is contained in:
		| @ -71,15 +71,11 @@ SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked") | ||||
|  | ||||
|  | ||||
| def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): | ||||
|     temp_zip_path = path.join(temp_dir, plugin_name) | ||||
|  | ||||
|     # Download and extract file in temp dir | ||||
|     with urllib.request.urlopen(zip_path) as req: | ||||
|         with open(temp_zip_path, "wb") as f: | ||||
|             f.write(BytesIO(req.read())) | ||||
|             zip_f = zipfile.ZipFile(temp_zip_path) | ||||
|             zip_f.extractall(temp_dir) | ||||
|             content_disp = req.headers.get("Content-Disposition") | ||||
|         zip_f = zipfile.ZipFile(BytesIO(req.read())) | ||||
|         zip_f.extractall(temp_dir) | ||||
|         content_disp = req.headers.get("Content-Disposition") | ||||
|  | ||||
|     filename = re.findall("filename=(.+).zip", content_disp)[0] | ||||
|     plugin_temp_path = path.join(temp_dir, path.join(temp_dir, filename)) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Tingfeng
					Tingfeng