Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 5331672

Browse files
author
Diego Cabrejas
committed
#67: Eliminate usage of Zend_Mime from Magento 2 Open Source
- Add Magento's own Mime class to replace usage of Zend_Mime
1 parent 068a97e commit 5331672

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

app/code/Magento/Downloadable/Controller/Download.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function _processDownload($path, $resourceType)
6464
$contentDisposition = $helper->getContentDisposition();
6565
if (!$contentDisposition || in_array($contentType, $this->disallowedContentTypes)) {
6666
// For security reasons we force browsers to download the file instead of opening it.
67-
$contentDisposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
67+
$contentDisposition = \Magento\Framework\HTTP\Mime::DISPOSITION_ATTACHMENT;
6868
}
6969

7070
$response->setHeader('Content-Disposition', $contentDisposition . '; filename=' . $fileName);

app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ public function linkNotAvailableDataProvider()
492492
public function downloadTypesDataProvider()
493493
{
494494
return [
495-
['mimeType' => 'text/html', 'disposition' => \Zend_Mime::DISPOSITION_ATTACHMENT],
496-
['mimeType' => 'image/jpeg', 'disposition' => \Zend_Mime::DISPOSITION_INLINE],
495+
['mimeType' => 'text/html', 'disposition' => \Magento\Framework\HTTP\Mime::DISPOSITION_ATTACHMENT],
496+
['mimeType' => 'image/jpeg', 'disposition' => \Magento\Framework\HTTP\Mime::DISPOSITION_INLINE],
497497
];
498498
}
499499
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\HTTP;
8+
9+
/**
10+
* Support class for MultiPart Mime Messages
11+
*/
12+
class Mime
13+
{
14+
const TYPE_OCTETSTREAM = 'application/octet-stream';
15+
const TYPE_TEXT = 'text/plain';
16+
const TYPE_HTML = 'text/html';
17+
const ENCODING_7BIT = '7bit';
18+
const ENCODING_8BIT = '8bit';
19+
const ENCODING_QUOTEDPRINTABLE = 'quoted-printable';
20+
const ENCODING_BASE64 = 'base64';
21+
const DISPOSITION_ATTACHMENT = 'attachment';
22+
const DISPOSITION_INLINE = 'inline';
23+
const LINELENGTH = 72;
24+
const LINEEND = "\n";
25+
const MULTIPART_ALTERNATIVE = 'multipart/alternative';
26+
const MULTIPART_MIXED = 'multipart/mixed';
27+
const MULTIPART_RELATED = 'multipart/related';
28+
}

0 commit comments

Comments
 (0)