cat-documents-ng 0.3.24 → 0.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5533,34 +5533,20 @@ class DocumentHistoryService {
|
|
|
5533
5533
|
console.warn(ERRORS.NO_DOCUMENT_URL);
|
|
5534
5534
|
return;
|
|
5535
5535
|
}
|
|
5536
|
-
console.log('Downloading document:', { documentUrl, docName });
|
|
5537
5536
|
this.http.get(documentUrl, { responseType: 'blob' }).subscribe({
|
|
5538
5537
|
next: (blob) => {
|
|
5539
|
-
console.log('Download successful, blob size:', blob.size, 'blob type:', blob.type);
|
|
5540
|
-
// Ensure PDF files have .pdf extension
|
|
5541
|
-
let downloadName = docName ?? SHARED.DOCUMENT;
|
|
5542
|
-
if (blob.type === 'application/pdf' && !downloadName.toLowerCase().endsWith('.pdf')) {
|
|
5543
|
-
downloadName = downloadName + '.pdf';
|
|
5544
|
-
}
|
|
5545
5538
|
const blobUrl = window.URL.createObjectURL(blob);
|
|
5546
5539
|
const a = document.createElement('a');
|
|
5547
5540
|
a.href = blobUrl;
|
|
5548
|
-
a.download =
|
|
5541
|
+
a.download = docName ?? SHARED.DOCUMENT;
|
|
5549
5542
|
a.style.display = SHARED.NONE;
|
|
5550
5543
|
document.body.appendChild(a);
|
|
5551
5544
|
a.click();
|
|
5552
5545
|
a.remove();
|
|
5553
5546
|
window.URL.revokeObjectURL(blobUrl);
|
|
5554
|
-
console.log('Download initiated for:', downloadName);
|
|
5555
5547
|
},
|
|
5556
5548
|
error: (err) => {
|
|
5557
5549
|
console.error(ERRORS.DOWNLOAD_FAIL, err);
|
|
5558
|
-
console.error('Download error details:', {
|
|
5559
|
-
status: err.status,
|
|
5560
|
-
statusText: err.statusText,
|
|
5561
|
-
message: err.message,
|
|
5562
|
-
url: documentUrl
|
|
5563
|
-
});
|
|
5564
5550
|
}
|
|
5565
5551
|
});
|
|
5566
5552
|
}
|