Skip to content

Commit 0ab857e

Browse files
committed
Updated 3214729 PDF filename is generated with it's location patch
1 parent d67369d commit 0ab857e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"2449895 Imported PO files have no public URL but have a link at admin/content/files" : "https://www.drupal.org/files/issues/2021-12-19/2449895_92.patch"
218218
},
219219
"drupal/printable": {
220-
"3214729 PDF filename is generated with it's location" : "https://git.drupalcode.org/issue/printable-3214729/-/commit/cbc98dbe864f82b4cc1da110d88097d0c4740bb9.patch"
220+
"3214729 PDF filename is generated with it's location" : "./patches/3214729_pdf_filename_generated_with_its_location.patch"
221221
},
222222
"drupal/scheduler_content_moderation_integration" : {
223223
"Widget error when field is overridden - undefined offset 0 in $form['publish_state']" : "https://www.drupal.org/files/issues/2020-06-30/3077147-28.patch"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php b/modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php
2+
index 3eb8e73..b6fb0dc 100755
3+
--- a/modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php
4+
+++ b/modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php
5+
@@ -262,20 +262,20 @@ class PdfFormat extends PrintableFormatBase {
6+
/**
7+
* Return default headers (may be overridden by the generator).
8+
*
9+
- * @param string $filename
10+
- * The path to generated file that is sent to the browser.
11+
+ * @param string $filepath
12+
+ * The path to generated file that is sending to the browser.
13+
* @param bool $download
14+
* Whether to download the PDF or display it in the browser.
15+
*
16+
* @return array
17+
* Default headers for the response object.
18+
*/
19+
- private function getHeaders($filename, $download) {
20+
+ private function getHeaders($filepath, $download) {
21+
$disposition = $download ? 'attachment' : 'inline';
22+
return [
23+
'Content-Type' => Unicode::mimeHeaderEncode('application/pdf'),
24+
- 'Content-Disposition' => $disposition . '; filename="' . basename($filename) . '"',
25+
- 'Content-Length' => filesize($filename),
26+
+ 'Content-Disposition' => $disposition . '; filename="' . basename($filepath) . '"',
27+
+ 'Content-Length' => filesize($filepath),
28+
'Content-Transfer-Encoding' => 'binary',
29+
'Pragma' => 'no-cache',
30+
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',

0 commit comments

Comments
 (0)