XWIKI-11528: Office viewer fails if the page where the file is attached has a special character in the name (whitespace)
* Add only the office file name to the temporary file path if the resource is specified by an attachment reference, because the rest of the information (wiki/space/page) are already included in the path.
* Use Base64 encoding for the resource reference when adding it to the path because it can contain special characters that are prohibited in the URL by some servlet containers even when they are URL-encoded.

(cherry picked from commit 0cea6390abdeb0b2ef50bbdfc580f49b0ec8fd88)