summaryrefslogtreecommitdiffstats
path: root/lib/private/backgroundjob
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-02-17 16:52:09 +0100
committerRobin Appelman <icewind@owncloud.com>2015-02-25 15:08:40 +0100
commitc2a7fff4f6f79e37aedf299fd01727efd9082450 (patch)
tree31429675500a3c9e43f1d0ea3f587f77e8727156 /lib/private/backgroundjob
parent6fc0eb02360dc9f997bdffd0a4efeb25425ddd75 (diff)
downloadnextcloud-server-c2a7fff4f6f79e37aedf299fd01727efd9082450.tar.gz
nextcloud-server-c2a7fff4f6f79e37aedf299fd01727efd9082450.zip
throw an exception when trying to push a background job that wont fit in the table
otherwise it will lead to failures in json decode and unexpected and hard to debug issues when running the job
Diffstat (limited to 'lib/private/backgroundjob')
-rw-r--r--lib/private/backgroundjob/joblist.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php
index 4011572f62e..95a7b125801 100644
--- a/lib/private/backgroundjob/joblist.php
+++ b/lib/private/backgroundjob/joblist.php
@@ -57,6 +57,9 @@ class JobList implements IJobList {
$class = $job;
}
$argument = json_encode($argument);
+ if (strlen($argument) > 2048) {
+ throw new \InvalidArgumentException('Background job arguments cant exceed 2048 characters (json encoded');
+ }
$query = $this->conn->prepare('INSERT INTO `*PREFIX*jobs`(`class`, `argument`, `last_run`) VALUES(?, ?, 0)');
$query->execute(array($class, $argument));
}