allow objects to start with /, but not to contain //; sanitise after validation
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
df54ab3284
commit
0082b7f07c
1 changed files with 1 additions and 3 deletions
|
@ -102,8 +102,6 @@ class CdistObject(object):
|
||||||
"""Validate the given object_id and raise IllegalObjectIdError if it's not valid.
|
"""Validate the given object_id and raise IllegalObjectIdError if it's not valid.
|
||||||
"""
|
"""
|
||||||
if self.object_id:
|
if self.object_id:
|
||||||
if self.object_id.startswith('/'):
|
|
||||||
raise IllegalObjectIdError(self.object_id, 'object_id may not start with /')
|
|
||||||
if OBJECT_MARKER in self.object_id.split(os.sep):
|
if OBJECT_MARKER in self.object_id.split(os.sep):
|
||||||
raise IllegalObjectIdError(self.object_id, 'object_id may not contain \'%s\'' % OBJECT_MARKER)
|
raise IllegalObjectIdError(self.object_id, 'object_id may not contain \'%s\'' % OBJECT_MARKER)
|
||||||
if '//' in self.object_id:
|
if '//' in self.object_id:
|
||||||
|
@ -119,8 +117,8 @@ class CdistObject(object):
|
||||||
self.base_path = base_path
|
self.base_path = base_path
|
||||||
self.object_id = object_id
|
self.object_id = object_id
|
||||||
|
|
||||||
self.sanitise_object_id()
|
|
||||||
self.validate_object_id()
|
self.validate_object_id()
|
||||||
|
self.sanitise_object_id()
|
||||||
|
|
||||||
self.name = self.join_name(self.cdist_type.name, self.object_id)
|
self.name = self.join_name(self.cdist_type.name, self.object_id)
|
||||||
self.path = os.path.join(self.cdist_type.path, self.object_id, OBJECT_MARKER)
|
self.path = os.path.join(self.cdist_type.path, self.object_id, OBJECT_MARKER)
|
||||||
|
|
Loading…
Reference in a new issue