diff roundup/cgi/client.py @ 5555:7b663b588292 REST-rebased

Don't pass huge itemids into the backend. [[Ralf Schlatterbeck: Note that the original patch wasn't python3 compatible and used long instead of int. Verified that python2.7 can deal with long numeric strings, e.g. 2**64 * 10: int("184467440737095516160")]] committer: Ralf Schlatterbeck <rsc@runtux.com>
author martin.v.loewis <martin.v.loewis>
date Tue, 29 Jan 2019 15:13:44 +0100
parents a06a88ed38ae
children d75aa88c2a99
line wrap: on
line diff
--- a/roundup/cgi/client.py	Tue Jan 29 14:40:39 2019 +0100
+++ b/roundup/cgi/client.py	Tue Jan 29 15:13:44 2019 +0100
@@ -1351,6 +1351,10 @@
                 klass = self.db.getclass(self.classname)
             except KeyError:
                 raise NotFound('%s/%s'%(self.classname, self.nodeid))
+            if int(self.nodeid) > 2**31:
+                # Postgres will complain with a ProgrammingError
+                # if we try to pass in numbers that are too large
+                raise NotFound ('%s/%s'%(self.classname, self.nodeid))
             if not klass.hasnode(self.nodeid):
                 raise NotFound('%s/%s'%(self.classname, self.nodeid))
             # with a designator, we default to item view

Roundup Issue Tracker: http://roundup-tracker.org/