exit after media file handling
trim whitespace around URLs

fixes #423