From 7370dee913a63a2f7d4bc09bd4e5605eac2eb382 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 29 Apr 2020 02:23:29 +0200 Subject: fix bookmark construction in user fix colortag file creation by fixing fn access media --- app/class/Modelmedia.php | 4 ++++ app/class/User.php | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'app/class') diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index 4da7707..89a2305 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -376,9 +376,13 @@ class Modelmedia extends Model { try { accessfile($oldname); + accessfile($newname); } catch (InvalidArgumentException $e) { throw new InvalidArgumentException($e->getMessage()); } + if (!file_exists($oldname)) { + throw new InvalidArgumentException("File : $oldname does not exist"); + } return rename($oldname, $newname); } } diff --git a/app/class/User.php b/app/class/User.php index efd89ae..e78c10c 100644 --- a/app/class/User.php +++ b/app/class/User.php @@ -202,9 +202,13 @@ class User extends Item if (is_array($bookmark)) { $bookmark = array_map( function ($datas) { - try { - return new Bookmark($datas); - } catch (RuntimeException $e) { + if (is_array($datas)) { + try { + return new Bookmark($datas); + } catch (RuntimeException $e) { + return false; + } + } else { return false; } }, -- cgit v1.2.3