[BACKEND] uid_sanitized variable (#256)

This commit is contained in:
Jesse Bannon 2022-09-29 00:33:57 -07:00 committed by GitHub
parent 4b6add06e1
commit 7d29b72010
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -40,6 +40,16 @@ class BaseEntryVariables:
""" """
return self.kwargs(UID) return self.kwargs(UID)
@property
def uid_sanitized(self: "BaseEntry") -> str:
"""
Returns
-------
str
The sanitized uid of the entry, which is safe to use for Unix and Windows file names.
"""
return sanitize_filename(self.uid)
@property @property
def extractor(self: "BaseEntry") -> str: def extractor(self: "BaseEntry") -> str:
""" """

View file

@ -61,6 +61,7 @@ def mock_entry_to_dict(
): ):
return { return {
"uid": uid, "uid": uid,
"uid_sanitized": uid,
"title": "entry title", "title": "entry title",
"title_sanitized": "entry title", "title_sanitized": "entry title",
"ext": ext, "ext": ext,