File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 44
55use Kirby \Cms \App ;
66use Kirby \Cms \User ;
7+ use Kirby \Data \Yaml ;
78use Kirby \Filesystem \F ;
89use Kirby \Toolkit \A ;
10+ use Kirby \Toolkit \Str ;
911use tobimori \DreamForm \DreamForm ;
1012use tobimori \DreamForm \Models \FormPage ;
1113
14+ use function is_string ;
1215use function is_array ;
1316
1417/**
@@ -263,13 +266,14 @@ protected function attachments(): array
263266 foreach ($ this ->block ()->attachments ()->split () as $ id ) {
264267 $ value = $ this ->submission ()->valueForId ($ id );
265268
266- if (is_string ($ value ->value ())) { // is a file uuid
269+ if (Str:: contains ($ value ->value (), ' file:// ' )) { // is a file uuid
267270 $ files = $ value ->toFiles ();
268271 foreach ($ files as $ file ) {
269272 $ attachments [] = $ file ;
270273 }
271- } else { // is PHP file object
272- $ files = array_values (A::filter ($ value ->value (), fn ($ file ) => $ file ['error ' ] === UPLOAD_ERR_OK ));
274+ } else { // is PHP file object stored as YAML
275+ $ uploadData = Yaml::decode ($ value ->value ());
276+ $ files = array_values (A::filter ($ uploadData , fn ($ file ) => $ file ['error ' ] === UPLOAD_ERR_OK ));
273277 foreach ($ files as $ file ) {
274278 $ attachments [] = [
275279 'path ' => $ file ['tmp_name ' ],
You can’t perform that action at this time.
0 commit comments