From eaed402cfbabc7b5e470b369fd02e83c3dcefbe8 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 10 May 2024 12:21:31 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1918 --- wire/modules/Inputfield/InputfieldFile/InputfieldFile.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module index 1dd36394..cdd31d63 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module @@ -668,9 +668,9 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel $fieldName = (string) $this->hasField; } - $postUrl = $page->editUrl(); + $postUrl = $page ? $page->editUrl() : ''; - if($nameAttr != $fieldName) { + if($nameAttr != $fieldName && $fieldName && $postUrl) { // file context for output after upload in case upload starts from a // page that is different from the one where the the file actually lives, // but file upload is posted to the correct page. this ensures the resulting