fixed empty URLs

'I've spent 4 hours trying to figure out why the generated PDF does not consider CSS rules.

Well, I found out (by looking into the `/tmp` directory) that everything in brackets got replaced with `file://<previouscontent>`. That meant no CSS would get applied.

Then I figured that it was because of the fact that my MEDIA_URL was empty and thus the regex that looks for the links tried to prepend everything inbrackets with `file://`. 

This pull request tries to fix this behaviour and save the mankind some human hours.