From 0f7875eedad179bbbd8a6eb910bdd561d9908d75 Mon Sep 17 00:00:00 2001 From: Filip Hendrik Date: Thu, 30 Mar 2017 02:21:14 +0200 Subject: [PATCH] Filter on and output the correct content type. --- LBRY.class.php | 1 + image.php | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/LBRY.class.php b/LBRY.class.php index b7eaef79..0a5008b1 100644 --- a/LBRY.class.php +++ b/LBRY.class.php @@ -39,6 +39,7 @@ class LBRY return //TODO: Expand these checks AND verify it is an image claim! ($metadata['license'] == "Public Domain" || stripos($metadata['license'], 'Creative Commons') !== false) && + in_array($metadata['content_type'], ['image/jpeg', 'image/png']) && !isset($metadata['fee']); }); diff --git a/image.php b/image.php index 89a53493..d09f3469 100644 --- a/image.php +++ b/image.php @@ -11,9 +11,7 @@ if ($claim) if (isset($getResult['completed']) && $getResult['completed'] && isset($getResult['download_path'])) { $path = $getResult['download_path']; - //TODO, verify it is an image - //TODO: serve the correct content type! - header('Content-type: image/jpeg'); + header('Content-type: ' . $getResult['metadata']['content_type']); header('Content-length: ' . filesize($path)); readfile($getResult['download_path']); } -- 2.45.3