URI encode document key when generating URL

Trivial bugfix, might be needed other places too, but I assume that documents are most likely to have exotic keys.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@veridu.com>