From 285a67ad3b7dd1e785c315a0dc1b4905c055709d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Jan 2026 17:53:14 +0100 Subject: [PATCH] FIX API content-type assignment (#36771) Co-authored-by: Laurent Destailleur --- htdocs/api/class/api_documents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 4073ddcd0d8..66e0918c35d 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -792,9 +792,9 @@ class Documents extends DolibarrApi $filearray[$i] = array_merge($filearray[$i], (array) $line); } } - if (isset($line->filename)) $filearray[$i]['content-type'] = dol_mimetype($line->filename); + if (isset($filearray[$i]['relativename'])) $filearray[$i]['content-type'] = dol_mimetype($filearray[$i]['relativename']); $arraycontenttype = explode(",", $content_type); - if (!empty($content_type) && isset($line->filename) && !in_array(dol_mimetype($line->filename), $arraycontenttype)) { + if (!empty($content_type) && isset($filearray[$i]['relativename']) && !in_array(dol_mimetype($filearray[$i]['relativename']), $arraycontenttype)) { unset($filearray[$i]); $countarray -= 1; }