Update app.py
Browse files
app.py
CHANGED
@@ -404,17 +404,19 @@ class App:
|
|
404 |
|
405 |
@staticmethod
|
406 |
def generate_download_script(files):
|
407 |
-
|
408 |
-
for
|
409 |
-
|
|
|
410 |
var link = document.createElement('a');
|
411 |
-
link.href = '/file={
|
412 |
-
link.download = '{
|
413 |
document.body.appendChild(link);
|
414 |
link.click();
|
415 |
document.body.removeChild(link);
|
416 |
"""
|
417 |
-
|
|
|
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()
|