jenkins-bot has submitted this change and it was merged.

Change subject: Use MW function to generate Content-Disposition header
......................................................................


Use MW function to generate Content-Disposition header

Bug: T149773
Change-Id: Ie1c151652dfde6b9680a281d385de8cdd03fff5b
---
M specials/SpecialElectronPdf.php
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  WMDE-Fisch: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/specials/SpecialElectronPdf.php b/specials/SpecialElectronPdf.php
index 53b93d4..00ab80c 100644
--- a/specials/SpecialElectronPdf.php
+++ b/specials/SpecialElectronPdf.php
@@ -140,7 +140,7 @@
                $request->setCallback( [ $this, 'writeToTempFile' ] );
 
                if ( $request->execute()->isOK() ) {
-                       $this->sendPdfToOutput( $title->getText() );
+                       $this->sendPdfToOutput( $title->getPrefixedText() );
                } else {
                        $this->getOutput()->showErrorPage(
                                'electronPdfService-page-notfound-title',
@@ -193,10 +193,11 @@
 
        private function sendPdfToOutput( $page ) {
                $fileMetaData = stream_get_meta_data( $this->tempFileHandle );
+               $contentDisposition = FileBackend::makeContentDisposition( 
'inline', $page . '.pdf' );
                wfResetOutputBuffers();
                header( 'Content-Type:application/pdf' );
                header( 'Content-Length: ' . filesize( $fileMetaData['uri'] ) );
-               header( 'Content-Disposition: inline; filename=' . $page . 
'.pdf' );
+               header( 'Content-Disposition: ' . $contentDisposition );
                fseek( $this->tempFileHandle, 0 );
                fpassthru( $this->tempFileHandle );
                $this->getOutput()->disable();

-- 
To view, visit https://gerrit.wikimedia.org/r/319595
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1c151652dfde6b9680a281d385de8cdd03fff5b
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/ElectronPdfService
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to