diff --git a/app/api/files.py b/app/api/files.py
index de4fa541..ab1ba50a 100644
--- a/app/api/files.py
+++ b/app/api/files.py
@@ -568,7 +568,7 @@ def get_file_preview(
return FileResponse(
path=file_path,
media_type=file_record.mime_type or "application/pdf",
- filename=file_record.original_filename,
+ headers={"Content-Disposition": f'inline; filename="{file_record.original_filename}"'},
)
except HTTPException:
diff --git a/frontend/static/js/upload.js b/frontend/static/js/upload.js
index 48be819c..13786cf7 100644
--- a/frontend/static/js/upload.js
+++ b/frontend/static/js/upload.js
@@ -195,6 +195,12 @@ function updateOverallStatus(statusMessage) {
if (completed === total) {
statusMessage.textContent = `All uploads completed (${completed}/${total})`;
+
+ // Trigger a custom event when all uploads are complete
+ const allUploadsComplete = new CustomEvent('allUploadsComplete', {
+ detail: { total: total, completed: completed }
+ });
+ window.dispatchEvent(allUploadsComplete);
} else {
statusMessage.textContent = `Uploading files (${completed}/${total})`;
}
diff --git a/frontend/templates/file_detail.html b/frontend/templates/file_detail.html
index 3996422f..93c05010 100644
--- a/frontend/templates/file_detail.html
+++ b/frontend/templates/file_detail.html
@@ -863,12 +863,24 @@
Original File
-
-
{% endif %}
@@ -877,12 +889,16 @@
Processed File
-
-
{% endif %}
diff --git a/frontend/templates/files.html b/frontend/templates/files.html
index 0d780e16..e27e295b 100644
--- a/frontend/templates/files.html
+++ b/frontend/templates/files.html
@@ -835,27 +835,17 @@
// Process the dropped files
processFiles(e.dataTransfer.files, uploadProgressContainer, uploadStatusMessage);
-
- // Optionally reload page after uploads complete (with a delay)
- setTimeout(() => {
- const fileStatuses = document.querySelectorAll('.file-status');
- let allCompleted = true;
- fileStatuses.forEach(status => {
- if (!status.textContent.includes('Success') && !status.textContent.includes('Error')) {
- allCompleted = false;
- }
- });
-
- if (allCompleted && fileStatuses.length > 0) {
- // Refresh the page after a short delay to show the new files
- setTimeout(() => {
- window.location.reload();
- }, 2000);
- }
- }, 1000);
}
});
+ // Listen for upload completion event and reload the page to show new files
+ window.addEventListener('allUploadsComplete', (e) => {
+ // Wait 2 seconds to let users see the success message
+ setTimeout(() => {
+ window.location.reload();
+ }, 2000);
+ });
+
function closeUploadModal() {
uploadModal.classList.remove('active');
}