-
Suggestion
-
Resolution: Unresolved
-
None
-
0
-
3
-
Our documentation at Upload a file warns that we should not use special characters on the name of the file:
Avoid using special characters in page or attachment names, as the page or attachment may not be found by Confluence search and may cause some Confluence functions to behave unexpectedly.
However, we do not validate the file name when attaching to a page, so users might upload files with special characters. If these characters are not properly encoded using the URL encoding (percent-encoding), the links to the attachments might be invalid and return HTTP error 400 (Bad Request or Not found error).
The recommended Special characters to be URL encoded (percent-encoding) are: ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', as well as '%' itself. Other characters don't need to be encoded, though they could (Reference: https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding)
Testing the upload of some files using these characters, we could observe that the solution applied is following a character-per-character basis.
Some characters are URL-encoded, others are replaced when uploading or downloading, and some are URL encoded but the information retrieved by the REST API Get Page By ID shows a different encoding (see table below for some samples).
Goal: It would avoid many issues if the link always uses URL-encoding as a pattern for the attachments.
Test:
char | Attachment URL | Downloaded file | Get page by ID | notes |
---|---|---|---|---|
! (%21) | x/download/attachments/26673219/a!a.jpg?api=v2 | a!a.jpg | a!a.jpg | ![]() |
" (%22) | x/download/attachments/26673219/x%22x.jpg?api=v2 | a_a.jpg | x%22x.jpg | ![]() |
"#" (%23) | x/download/attachments/26673219/a%23a.jpg?api=v2 | a#a.jpg | a%23a.jpg | ![]() |
$ (%24) | x/download/attachments/26673219/a$a.jpg?api=v2 | a$a.jpg | a$a.jpg | ![]() |
% (%25) | x/download/attachments/26673219/a%25a.jpg?api=v2 | a%a.jpg | a%25a.jpg | ![]() |
& (%26) | x/download/attachments/26673219/a%26a.jpg?api=v2 | a&a.jpg | a& amp;a.jpg | ![]() |
' (%27) | x/download/attachments/26673219/a%27%20a.jpg?api=v2 | a'a.jpg | a'a.jpg | ![]() |
( (%28) | x/download/attachments/26673219/a(a)a.jpg?api=v2 | a(a)a.jpg | a(a)a.jpg | ![]() |
"*" (%2A) | x/download/attachments/26673219/a*a.jpg?api=v2 | a_a.jpg | a*a.jpg | replaced and not encoded |
+ (%2B) | x/download/attachments/26673219/a%2Ba.jpg?api=v2 | a+a.jpg | a+a.jpg | ![]() |
/ (%2F) | x/download/attachments/26673219/y:y.jpg?api=v2 | a_a.jpg | y:y.jpg | ![]() |
: (%3A) | x/download/attachments/26673219/a:a.jpg?api=v2 | a_a.jpg | a:a.jpg | ![]() |
; (%3B) | x/download/attachments/26673219/a;a.jpg?api=v2 | ![]() |
a;a.jpg | ![]() |
\ (%5C) | x/download/attachments/26673219/a%5Ca.jpg?api=v2 | ![]() |
a%5Ca.jpg | ![]() |
- is related to
-
CONFCLOUD-77723 Attachment using the ampersand character in the File name uses the wrong encoding on the REST/API
-
- Closed
-
-
CONFCLOUD-75932 Allow attachments with names having special characters
- Closed
-
CONFCLOUD-74200 Remove filename from download attachments url
- Gathering Interest
- mentioned in
-
Page Loading...