From 1ee52f219a516d831b4be6bd05bce224afa28189 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 01:12:38 +0000
Subject: [PATCH] =minor fixes to uploading

---
 inc/rest/routes/UploadRoutes.php |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/inc/rest/routes/UploadRoutes.php b/inc/rest/routes/UploadRoutes.php
index 8ac6fe6..4b2a4a6 100644
--- a/inc/rest/routes/UploadRoutes.php
+++ b/inc/rest/routes/UploadRoutes.php
@@ -90,7 +90,9 @@
 		Route::for('uploads')
 			->post([$this, 'handleUpload'])
 			->auth(PermissionHandler::combine(['nonce']))
-			->rateLimit(30);
+			->rateLimit(30)
+			->register();
+
 		Route::for('uploads/groups')
 			->post([$this, 'handleGroupingRequest'])
 			->auth(PermissionHandler::combine(['nonce']))
@@ -132,7 +134,6 @@
 				case 'item_id':
 					if (is_numeric($value)) {
 						$args['item_id'] = absint($value);
-						// item_id IS the post/term being edited — use as post_id if not already set
 						if (!array_key_exists('post_id', $args)) {
 							$args['post_id'] = absint($value);
 						}
@@ -157,7 +158,10 @@
 				case 'user':
 					if ($this->userCheck($value)) {
 						$args['user'] = (int) $value;
-						if (!array_key_exists('post_id', $args) && !array_key_exists('term_id', $args) && !array_key_exists('item_id', $args)) {
+						if (!array_key_exists('post_id', $args) &&
+							!array_key_exists('post_id', $data) &&
+							!array_key_exists('term_id', $data) &&
+							!array_key_exists('item_id', $data)) {
 							$args['post_id'] = (int)get_user_meta((int) $value, BASE.'link', true);
 						}
 					}

--
Gitblit v1.10.0