From 85471e007e644f216ca6334d597f3135a97bd418 Mon Sep 17 00:00:00 2001
From: Lorenzo Yario <angeleno@screamer.wiki>
Date: Fri, 19 Apr 2024 12:03:49 -0700
Subject: [PATCH] vichan likes to error on the ban appeals page if this isn't
 set this way

---
 inc/display.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/inc/display.php b/inc/display.php
index 1d74424f..8a863648 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -351,13 +351,20 @@ class Post {
 		if (isset($this->files) && $this->files) {
 			$this->files = is_string($this->files) ? json_decode($this->files) : $this->files;
 			// Compatibility for posts before individual file hashing
-			foreach ($this->files as $i => &$file) {
+						foreach ($this->files as $i => &$file) {
 				if (empty($file)) {
 					unset($this->files[$i]);
 					continue;
 				}
-				if (!isset($file->hash))
-					$file->hash = $this->filehash;
+				if (is_array($file)) {
+					if (!isset($file['hash'])) {
+						$file['hash'] = $this->filehash;
+					}
+				} else if (is_object($file)) {
+					if (!isset($file->hash)) {
+						$file->hash = $this->filehash;
+					}
+				}
 			}
 		}