nunaliit2-js: Add a function to compute attachment URLs, making sure the
URI components are encoded correctly. Modify code that computes
attachment URL to use new function.

Issue #111