[File Document] File name is getting cut if it contains an and-sign (&)

0
Hi Mendix Community, Today I ran into an issue where a customer reported that at least two files (a PDF and a PPTX) both lost there file extension after uploading and downloading it to our Mendix application. Therefore, other users downloading those files were unable to open them as their operating systems did not know which program to use for opening the files. After re-uploading one of the original files and checking the download result, I saw that the whole filename was cut after 37 characters. Therefore, I at first checked the Domain Model to see if there is some restriction for a file document or at out own entity we are using file document as a generalization. However, both had set the filename attribute to at least 200 chars in length.  In a closer look to the position where the filename was cut, I came to know that it happened at the first appearance of the and-sign (&) in the filename. After replacing/removing all and-signs in the filename of both files and re-uploading them, everything worked fine. Looks like these special characters are not getting correctly escaped / replaced. The plus-sign (+) I used as a replacement for one of the and-signs got removed from Mendix. I therefore assume, that there is already some escaping of special characters happening, but the and-sign is not treated correctly yet. For all of you running into similar issues: Try to remove or replace the special characters in your filenames. Best regards, Thomas
asked
1 answers
2

You need to use the urlEncode and urlDecode methods in Mendix to handle these characters. 

https://docs.mendix.com/refguide/string-function-calls#urlEncode

The & is used as a parameter separator when used in a URL. There is a useful list on Wikipedia explaining what characters need to be escaped and how if you need more background information.

https://en.wikipedia.org/wiki/Percent-encoding

answered