Added anti-imagejs checks and improved filename validation for sharing