replace filtered characters with underscore

This commit is contained in:
Sigbjørn Skjæret 2024-04-11 03:59:14 +02:00 committed by GitHub
parent 06808a3d0d
commit 87d5c3e496
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -477,7 +477,7 @@ class GGUFWriter:
template = choice.get('template')
# Allowing non-alphanumerical characters in template name is probably not a good idea, so filter it
name = ''.join((c for c in name if c in ['_'] + list(ascii_letters) + list(digits)))
name = ''.join((c if c in ascii_letters + digits else '_' for c in name))
if name and template is not None:
if name == 'default':