moved duplicate code outside of an "if else" statement
Files from other context now work when displayed as "Embed"