mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	[1.7.x] Fixed #22681 -- Made TarArchive recognize leading directories properly.
Backport of 083d285b82 from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							c8382f4c65
						
					
				
				
					commit
					8d6e0d4588
				
			| @@ -144,7 +144,7 @@ class TarArchive(BaseArchive): | ||||
|         # note: python<=2.5 doesn't seem to know about pax headers, filter them | ||||
|         members = [member for member in self._archive.getmembers() | ||||
|                    if member.name != 'pax_global_header'] | ||||
|         leading = self.has_leading_dir(members) | ||||
|         leading = self.has_leading_dir(x.name for x in members) | ||||
|         for member in members: | ||||
|             name = member.name | ||||
|             if leading: | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar.bz2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar.bz2
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.tar.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/utils_tests/archives/leadpath_foobar.zip
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -21,6 +21,7 @@ class ArchiveTester(object): | ||||
|         self.tmpdir = tempfile.mkdtemp() | ||||
|         self.addCleanup(shutil.rmtree, self.tmpdir) | ||||
|         self.archive_path = os.path.join(TEST_DIR, self.archive) | ||||
|         self.archive_lead_path = os.path.join(TEST_DIR, "leadpath_%s" % self.archive) | ||||
|         # Always start off in TEST_DIR. | ||||
|         os.chdir(TEST_DIR) | ||||
|  | ||||
| @@ -42,6 +43,10 @@ class ArchiveTester(object): | ||||
|         extract(self.archive_path, self.tmpdir) | ||||
|         self.check_files(self.tmpdir) | ||||
|  | ||||
|     def test_extract_function_with_leadpath(self): | ||||
|         extract(self.archive_lead_path, self.tmpdir) | ||||
|         self.check_files(self.tmpdir) | ||||
|  | ||||
|     def test_extract_function_no_to_path(self): | ||||
|         os.chdir(self.tmpdir) | ||||
|         extract(self.archive_path) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user