#2000 - Make legal_file::smash_extensions more robust.

- Fixed legal_file::smash_extensions.
- Added new unit test.
- Removed duplicated condition in existing unit test.