mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-31 18:42:33 +08:00
Enforce PAGE_MAXRAW, otherwise we have no way to differentiate between potentially all-integer 16 character identifiers. I can't think of a better way to do this, unfortunately.
This commit is contained in:
@@ -1006,6 +1006,7 @@ 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)
|
||||
@@ -1014,6 +1015,8 @@ def _placeholderRenderForEdit(trans, item_class, item_id):
|
||||
def _placeholderRenderForSave(trans, item_class, item_id, encode=False):
|
||||
try:
|
||||
decoded_item_id = int(item_id)
|
||||
if decoded_item_id >= PAGE_MAXRAW:
|
||||
raise ValueError("Identifier larger than maximum expected raw int, must be already encoded.")
|
||||
encoded_item_id = trans.app.security.encode_id(item_id)
|
||||
except ValueError:
|
||||
decoded_item_id = trans.app.security.decode_id(item_id)
|
||||
|
||||
Reference in New Issue
Block a user