Skip to content

Commit 7866113

Browse files
committed
fix: sanitize author name for nt output
1 parent e868ba0 commit 7866113

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

renku/core/models/provenance/agents.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ class Person:
5858
@_id.default
5959
def default_id(self):
6060
"""Set the default id."""
61+
import string
6162
if self.email:
6263
return 'mailto:{email}'.format(email=self.email)
63-
return '_:{}'.format(''.join(self.name.lower().split()))
64+
65+
# prep name to be a valid rdf string
66+
name = self.name.translate(str.maketrans('', '', string.punctuation))
67+
name = ''.join(filter(lambda x: x in string.printable, name))
68+
return '_:{}'.format(''.join(name.lower().split()))
6469

6570
@email.validator
6671
def check_email(self, attribute, value):

0 commit comments

Comments
 (0)