Fix #1107 by adding filename validation to new files.
Merge pull request #1172 from rkachowski/bugfix/1107

Fix #1107 by adding filename validation to new files.