LAP-DEV commited on
Commit
c1804b0
·
verified ·
1 Parent(s): 6150bd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -404,17 +404,19 @@ class App:
404
 
405
  @staticmethod
406
  def generate_download_script(files):
407
- links = ""
408
- for file in files:
409
- links += f"""
 
410
  var link = document.createElement('a');
411
- link.href = '/file={file.name}';
412
- link.download = '{file.name.split('/')[-1]}';
413
  document.body.appendChild(link);
414
  link.click();
415
  document.body.removeChild(link);
416
  """
417
- return f"<script>{links}</script>"
 
418
 
419
  # Create the parser for command-line arguments
420
  parser = argparse.ArgumentParser()
 
404
 
405
  @staticmethod
406
  def generate_download_script(files):
407
+ js = "<script>\n"
408
+ for f in files:
409
+ filename = f.name.split("/")[-1]
410
+ js += f"""
411
  var link = document.createElement('a');
412
+ link.href = '/file={f.name}';
413
+ link.download = '{filename}';
414
  document.body.appendChild(link);
415
  link.click();
416
  document.body.removeChild(link);
417
  """
418
+ js += "</script>"
419
+ return js
420
 
421
  # Create the parser for command-line arguments
422
  parser = argparse.ArgumentParser()