Cannot upload attachments with special characters - "Malformed characters" error

Kamil Beer
Contributor
September 27, 2023

Hi,

after a recent Jira Software upgrade from 9.6 to 9.10, users on my Jira instance are unable to upload attachments containing special characters like č, ř, š.

When they try to upload such an attachment, they see the following message:

"File "ÁBCD.DOC" was not uploaded

Could not save attachment to storage: Malformed input or input contains unmappable characters: ÁBCD.DOC"

What could be the reason for this? I already tried searching around and found that one of the solutions is to change the starting parameters to look like -

JVM_SUPPORT_RECOMMENDED_ARGS="-Datlasssian.plugins.enable.wait=300 -Dfile.encoding=utf-8 -Dsun.jnu.encoding=UTF-8"

However I found that newer versions of Java ignore these parameters. What can be done about this?

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 30, 2023

Hi @Kamil Beer 

What operating system are you using? Do you use Java 11? One of the things that you can try is to set up LANG environment variable to "en_US.UTF-8"

Kamil Beer
Contributor
October 6, 2023

hi @Mirek , I use CentOS 7 and OpenJDK 11.0.13. I did read about the LANG variable problem for unrelated systems, but I am not sure where to put it - if it should be local for the whole centos system, or just for Jira/CF. Can you please tell me more?

Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 6, 2023

Hi @Kamil Beer 

I think it should be set for whole OS. Maybe this would be helpful? 

https://www.tecmint.com/set-system-locales-in-linux/

Kamil Beer
Contributor
October 6, 2023

I did take a look, and unfortunately it was already set like that. Still, thanks for the tip.

Kamil Beer
Contributor
October 7, 2023

So I reviewed multiple factors that could be related to this - database encoding, filesystem encoding, Java encoding, tomcat encoding, and all are set to UTF-8. I'm out of ideas :(

Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 8, 2023

What error is exactly showing in the logs when uploading the problematic attachment? Is this same behavior no matter which browser? Did you tried upload it via REST API? 

https://confluence.atlassian.com/jirakb/how-to-add-an-attachment-to-a-jira-issue-using-rest-api-699957734.html

I am wondering if there any situation that would allow to upload it. 

Are you using any reverse proxy etc? (e.g Apache) 

Kamil Beer
Contributor
October 8, 2023

So this is an example of the error message.

SEVERE [http-nio-8080-exec-5] com.sun.jersey.spi.container.ContainerResponse.logException Mapped exception to response: 500 (Internal Server Error)
com.atlassian.jira.plugins.dnd.attachment.rest.AttachmentResource$RESTException
at com.atlassian.jira.plugins.dnd.attachment.rest.AttachmentResource.attachTemporaryfile(AttachmentResource.java:92)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java :205)

And a huge stack trace following after that.

This has been occuring to multiple users, so it is likely that they have different browsers, too. No, I didn't use REST API, just the regular drag and drop method.

I do use Nginx, although the URIEncoding=UTF-8 is set correctly in server.xml.

Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2023

Ok, before we think that this is a encoding problem and how to apply UTF-8 to every layer lets try to put few things together and try to look from a little different perspective.

If you recently upgraded then something definitively change in a way how requests are handled from client to server. Would be good first to check if JIRA in Safe Mode if working fine. I mean would be great to eliminate that some of the addon might be causing this. 

If we are able to reproduce the problem even if addons are not working (just clean JIRA) then we have to take a look on network layer.. 

That is also wy I suggested not using UI and browser and try to upload "problematic" attachment using REST API. It would be helpful to know if different method works. 

You mentioned that Nginx is used so would be since to bypass it for a moment and check how application behave if we directly access JIRA (without proxy). If we would still have problem that it must be a problem in a application itself or operating system / database. 

Then we can only focus on this layer and verify if everything is properly set. 

Kamil Beer
Contributor
October 9, 2023

Thanks for the advice. Putting Jira into safe mode didn't change anything, unfortunately.

Adding the attachment via postman does the same; I get this error in the terminal:

"

Got error while saving attachment čížek.docx: Got exception while saving attachment in attachment store. Exception: Malformed input or input contains unmappable characters: čížek.docx"
Like Mirek likes this
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2023

OK, so indeed it was related to LANG. Good to see a related KB article. Now it would be easier if anyone would have a similar problem. Glad that is resolved for you @Kamil Beer ! 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.10.0
TAGS
AUG Leaders

Atlassian Community Events