From 8418c5f003109a03176e01ee8cad2b05b3ebca01 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sat, 24 Feb 2024 16:00:41 +1100 Subject: [PATCH] Fix post updates --- slices/micropub/commands/posts/update.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slices/micropub/commands/posts/update.rb b/slices/micropub/commands/posts/update.rb index 5e3a3b9..2e06343 100644 --- a/slices/micropub/commands/posts/update.rb +++ b/slices/micropub/commands/posts/update.rb @@ -32,8 +32,8 @@ module Micropub content = params[:add].delete(:content)&.first name = params[:add].delete(:name) - attrs_to_add[:name] = name if post.name.empty? - attrs_to_add[:content] = markdown.call(content: content) if post.content.empty? + attrs_to_add[:name] = name if post&.name&.empty? + attrs_to_add[:content] = markdown.call(content: content) if post&.content&.empty? params[:add].keys.each_with_object(attrs_to_add) do |attr, memo| memo[attr] = params[:add][attr].first if post.fetch(attr, nil).nil?