should use media.slug_or_id incase a MediaEntry doesn't have a slug
fixes the inability to upload non ascii filenames, werkzeug strips all non ascii chars and returns an empty string. This checks if the filename contains non asciis and if it does generates a uuid for filename. Also the request version of filename is used for generating alternative title for upload

cherry-picked from dunkyp. fixed conflicts and missing import.