@@ -16,7 +16,7 @@ def download_from_url():
1616 with open (tarpath , "wb" ) as f :
1717 f .write (response .raw .read ())
1818 untarredpath = "/tmp/tmp123"
19- shutil .unpack_archive (tarpath , untarredpath )
19+ shutil .unpack_archive (tarpath , untarredpath ) # $result=BAD
2020
2121
2222# A source catching an S3 filename download
@@ -31,7 +31,7 @@ def download_from_url():
3131
3232s3 = boto3 .client ('s3' )
3333s3 .download_file (bucket_name , remote_ziped_name , local_ziped_path )
34- shutil .unpack_archive (local_ziped_path , base_dir )
34+ shutil .unpack_archive (local_ziped_path , base_dir ) # $result=BAD
3535
3636
3737# wget
@@ -45,11 +45,11 @@ def download_from_url():
4545
4646# download(url, out, bar) contains out parameter
4747wget .download (url , compressed_file )
48- shutil .unpack_archive (compressed_file , base_dir )
48+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
4949
5050# download(url) returns filename
5151compressed_file = wget .download (url )
52- shutil .unpack_archive (compressed_file , base_dir )
52+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
5353
5454
5555# A source coming from a CLI argparse module
@@ -63,7 +63,7 @@ def download_from_url():
6363
6464args = parser .parse_args ()
6565compressed_file = args .filename
66- shutil .unpack_archive (compressed_file , base_dir )
66+ shutil .unpack_archive (compressed_file , base_dir ) # $result=BAD
6767
6868
6969# A source coming from a CLI and downloaded
@@ -84,7 +84,7 @@ def download_from_url():
8484with open (tarpath , "wb" ) as f :
8585 f .write (response .raw .read ())
8686
87- shutil .unpack_archive (tarpath , base_dir )
87+ shutil .unpack_archive (tarpath , base_dir ) # $result=BAD
8888
8989# the django upload functionality
9090# see HttpRequest.FILES: https://docs.djangoproject.com/en/4.1/ref/request-response/#django.http.HttpRequest.FILES
@@ -102,22 +102,22 @@ def simple_upload(request):
102102 with open (savepath , 'wb+' ) as wfile :
103103 for chunk in request .FILES ["ufile1" ].chunks ():
104104 wfile .write (chunk )
105- shutil .unpack_archive (savepath , base_dir )
105+ shutil .unpack_archive (savepath , base_dir ) # $result=BAD
106106
107107 # Write in binary the uploaded tarball
108108 myfile = request .FILES .get ("ufile1" )
109109 file_path = os .path .join (base_dir , "tarball.tar" )
110110 with file_path .open ('wb' ) as f :
111111 f .write (myfile .read ())
112- shutil .unpack_archive (file_path , base_dir )
112+ shutil .unpack_archive (file_path , base_dir ) # $result=BAD
113113
114114 # Save uploaded files using FileSystemStorage Django API
115115 # see FileSystemStorage: https://docs.djangoproject.com/en/4.1/ref/files/storage/#django.core.files.storage.FileSystemStorage
116116 for ufile in request .FILES .getlist ():
117117 fs = FileSystemStorage ()
118118 filename = fs .save (ufile .name , ufile )
119119 uploaded_file_path = fs .path (filename )
120- shutil .unpack_archive (uploaded_file_path , base_dir )
120+ shutil .unpack_archive (uploaded_file_path , base_dir ) # $result=BAD
121121
122122 return render (request , 'simple_upload.html' )
123123
@@ -139,7 +139,7 @@ def simple_upload(request):
139139args = parser .parse_args ()
140140unsafe_filename_tar = args .filename
141141with tarfile .TarFile (unsafe_filename_tar , mode = "r" ) as tar :
142- tar .extractall (path = "/tmp/unpack/" , members = tar )
142+ tar .extractall (path = "/tmp/unpack/" , members = tar ) # $result=BAD
143143tar = tarfile .open (unsafe_filename_tar )
144144
145145
@@ -164,7 +164,7 @@ def simple_upload(request):
164164 if member .issym ():
165165 raise ValueError ("But it is a symlink" )
166166 result .append (member )
167- tar .extractall (path = tempfile .mkdtemp (), members = result )
167+ tar .extractall (path = tempfile .mkdtemp (), members = result ) # $result=BAD
168168 tar .close ()
169169
170170
@@ -173,7 +173,7 @@ def simple_upload(request):
173173with open (tarpath , "wb" ) as f :
174174 f .write (response .raw .read ())
175175target_dir = "/tmp/unpack"
176- tarfile .TarFile (tarpath , mode = "r" ).extractall (path = target_dir )
176+ tarfile .TarFile (tarpath , mode = "r" ).extractall (path = target_dir ) # $result=BAD
177177
178178
179179from pathlib import Path
@@ -198,4 +198,4 @@ def default_session() -> boto3.Session:
198198 target = cache_dir
199199 else :
200200 target = Path (tempfile .mkdtemp ())
201- shutil .unpack_archive (tmp .name , target )
201+ shutil .unpack_archive (tmp .name , target ) # $result=BAD
0 commit comments