mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
pybricksMicropython: don't allow files with dash
Since we are adding user imports, we need to make sure all file names are valid module names, so this means we can't use a dash.
This commit is contained in:
committed by
David Lechner
parent
81d52dbc52
commit
8b19ad5866
@@ -34,9 +34,9 @@ describe('validateFileName', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should allow file names with dashes', () => {
|
||||
it('should not allow file names with dashes', () => {
|
||||
expect(validateFileName('file-name', pythonFileExtension, [])).toBe(
|
||||
FileNameValidationResult.IsOk,
|
||||
FileNameValidationResult.HasInvalidCharacters,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export function validateFileName(
|
||||
return FileNameValidationResult.HasInvalidFirstCharacter;
|
||||
}
|
||||
|
||||
if (!fileName.match(/^[a-zA-Z0-9_-]+$/)) {
|
||||
if (!fileName.match(/^[a-zA-Z0-9_]+$/)) {
|
||||
return FileNameValidationResult.HasInvalidCharacters;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user