From 12ad1666a2a3eed158819aaa137820db1be2a488 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sat, 24 Feb 2024 15:11:20 +1100 Subject: [PATCH] Photo param parsing --- slices/micropub/request_parser.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/slices/micropub/request_parser.rb b/slices/micropub/request_parser.rb index edb16a3..0a78740 100644 --- a/slices/micropub/request_parser.rb +++ b/slices/micropub/request_parser.rb @@ -59,10 +59,16 @@ module Micropub params[:properties][:content].first&.tr("\n", " ") end end - photos = if params[:properties][:photo].is_a?(String) + photos = if params[:properties][:photo].is_a?(Array) + params[:properties][:photo].map do |p| + {value: p, alt: ""} + end + elsif params[:properties][:photo].is_a?(Hash) + params[:properties][:photo] + elsif {value: params[:properties][:photo], alt: ""} else - params[:properties][:photo] || [] + [] end new_params.merge({