Currently, when a file is uploaded, and an error is generated, a JSON
serialization error is thrown because of the unexpected JSON output.
This commit fixes that.
This fixes an issue where a file in a hashtag would cause the uploaded
file to be truncated after the hashtag, causing the share function to
fail subsequentially because the file was not found. Only the PUT
request to upload the file requires the hashtag to be encoded, as it's
part of the URL, while the POST request for the share has the path in
the POST parameters.
closes#1148.