diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-21 14:06:15 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-21 14:06:15 +0100 |
commit | 4715fb12c8001b8642c2e6dcef57ac216ef92c3d (patch) | |
tree | 7c6124f0a508e524770fb6fea6fc3a2d0ced816b /core/ajax | |
parent | 3f52eb073d56ead07c8479b4cb9faa44e6868234 (diff) | |
download | nextcloud-server-4715fb12c8001b8642c2e6dcef57ac216ef92c3d.tar.gz nextcloud-server-4715fb12c8001b8642c2e6dcef57ac216ef92c3d.zip |
Add url parameter to control whether previews should return 404 when the mimetype is unsupported
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/preview.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php index 5c6d5ce25ab..285af3a8a76 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -11,6 +11,7 @@ $file = array_key_exists('file', $_GET) ? (string)$_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '36'; $maxY = array_key_exists('y', $_GET) ? (int)$_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool)$_GET['scalingup'] : true; +$always = array_key_exists('always', $_GET) ? (bool)$_GET['always'] : true; if ($file === '') { //400 Bad Request @@ -28,7 +29,7 @@ if ($maxX === 0 || $maxY === 0) { try { $preview = new \OC\Preview(\OC_User::getUser(), 'files'); - if (!$preview->isMimeSupported(\OC\Files\Filesystem::getMimeType($file))) { + if (!$always and !$preview->isMimeSupported(\OC\Files\Filesystem::getMimeType($file))) { \OC_Response::setStatus(404); } else { $preview->setFile($file); |