Unable to import file attachment from CSV

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

When importing issues from a CSV file, the issues are imported but a warning message is displayed stating that the attachments could not be parsed as below:

By downloading the detailed log, the exception below can be seen:


2013-12-06 18:36:45,189 WARN - Cannot parse 'file://csvimport/test attachment.bmp' as attachment info: Illegal character in path at index 21: file://csvimport/test attachment.bmp
java.text.ParseException: Illegal character in path at index 21: file://csvimport/test attachment.bmp
	at com.atlassian.jira.plugins.importer.imports.csv.mappers.ExternalAttachmentMapper.validateURI(ExternalAttachmentMapper.java:86)
	at com.atlassian.jira.plugins.importer.imports.csv.mappers.ExternalAttachmentMapper.parse(ExternalAttachmentMapper.java:56)
	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getAttachmentsForIssue(CsvDataBean.java:445)
	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getAttachmentsForIssue(CsvDataBean.java:415)
	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.createIssue(DefaultJiraDataImporter.java:987)
	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.importIssues(DefaultJiraDataImporter.java:837)
	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.doImport(DefaultJiraDataImporter.java:422)
	at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:26)
	at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:15)
	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:374)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:250)
	at java.lang.Thread.run(Thread.java:724)

Cause

This issue may be caused because the attachment file being imported has special or reserved characters (e.g. space) in the file name, which are not supported in the file URI scheme used during the CSV attachment import.

Resolution

There are two options to resolve this issue:

  1. Rename the files so that they don't have special characters in their names (e.g. replace the spaces for underscores).


  2. Change the CSV file to use percent encoding for the special characters in the file name inside the CSV file.
    In the example below, the space was encoded to %20:

    example.csv
    Summary,Description,Issue Type,Priority,Assignee,Reporter,Attachments
    Test Import JIRA,"Test File Import",Task,Major,jirauser,jirauser,file://csvimport/test%20attachment.bmp

In case the solutions above do not solve the issue, please refer to this article: Unable to import file attachment from CSV due to NullPointerException

Last modified on Mar 21, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.