From dcf5d699bd6ce5770ebd515cc14219f3015dd63a Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 5 May 2016 08:21:21 +0200 Subject: simplify the md5 execution logic --- inc/api.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc/api.php') diff --git a/inc/api.php b/inc/api.php index 57e4d367..9483200e 100644 --- a/inc/api.php +++ b/inc/api.php @@ -92,7 +92,12 @@ class Api { $dotPos = strrpos($file->file, '.'); $apiPost['ext'] = substr($file->file, $dotPos); $apiPost['tim'] = substr($file->file, 0, $dotPos); - $apiPost['md5'] = base64_encode(hex2bin($post->filehash)); + if (isset ($file->hash) && $post->filehash) { + $apiPost['md5'] = base64_encode(hex2bin($file->hash)); + } + else if (isset ($post->filehash) && $post->filehash) { + $apiPost['md5'] = base64_encode(hex2bin($post->filehash)); + } } private function translatePost($post, $threadsPage = false) { -- cgit v1.3