From 3571df4e4d8324a84eaeb16cd840098165fb2ffd Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Fri, 7 Sep 2018 11:20:02 -0400 Subject: [PATCH] Use PAGE_MAXRAW in both places (refactor this after it all works perfectly) --- lib/galaxy/webapps/galaxy/controllers/page.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index faa0724c416..84f954b4428 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -72,6 +72,9 @@ _cp1252 = { } +PAGE_MAXRAW = 10**15 + + def format_bool(b): if b: return "yes" @@ -964,6 +967,8 @@ class PageController(BaseUIController, SharableMixin, # Assume if item id is integer and less than 10**15, it's unencoded. try: decoded_id = int(item_id) + if decoded_id >= PAGE_MAXRAW: + raise ValueError("Identifier larger than maximum expected raw int, must be already encoded.") encoded_id = self.app.security.encode_id(item_id) except ValueError: # It's an encoded id. @@ -1006,8 +1011,6 @@ PAGE_CLASS_MAPPING = { 'Visualization': 'Visualization' } -PAGE_MAXRAW = 10**15 - def _placeholderRenderForEdit(trans, item_class, item_id): return _placeholderRenderForSave(trans, item_class, item_id, encode=True)