From 787e4f5af6a4263bb2818a6a6e46878d7bd9af25 Mon Sep 17 00:00:00 2001 From: picklecillo Date: Fri, 15 Nov 2024 11:17:35 -0300 Subject: [PATCH] handling no body on title:body arg --- info.plist | 4 +--- src/inkdrop.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/info.plist b/info.plist index 6092680..fde79af 100644 --- a/info.plist +++ b/info.plist @@ -194,9 +194,7 @@ $password = getenv('password'); $inkdrop = new Inkdrop($host, $port, $username, $password); -$args = explode(":", $query, 2); -$title = $args[0]; -$body = $args[1]; +[$title, $body] = array_pad(explode(":", $query), 2, ''); $tags = getenv('defaultTags'); $notebook = getenv('defaultNotebook'); diff --git a/src/inkdrop.php b/src/inkdrop.php index eb94e59..14b9e20 100644 --- a/src/inkdrop.php +++ b/src/inkdrop.php @@ -59,7 +59,7 @@ public function create($title, $body, $notebook, $tags) { "status" => "active", "share" => "private", "title" => trim($title), - "body" => trim($body) ?? '', + "body" => trim($body), ); if (!empty($tags)) {