Is it possible to CSV import attachments including a semicolon in the name?

Florian Fahrenberger February 17, 2016

Hi everybody!

I am trying to transfer all of our old issues to JIRA Core, since we are switching to this as our new issue tracker. We decided to go with a CSV import, since our old issue tracker isn't supported natively and CSV still allows for things like dates and people to be imported correctly.

 

My problem is: Some of our old bugs have attachments with a semicolon ";" in the file name, and I want to transfer those to JIRA with the same name, since they are for example referenced in the issue description. The problem is that the attachments in the CSV file are supposed to be passed as a long string in the format:

"2015-10-01 14:30:00;UserName;filename.jpg;file://///path-to-file"

The link to the importable file is no problem, since it is in URL encoding anyways and a semicolon simply becomes "%3B". But if I try to import a file called "file;name.jpg" as

"2015-10-01 14:30:00;UserName;file;name.jpg;file://///path-to-file/file%3Bname.jpg"

I obviously get the error message "Cannot parse (...) as attachment info: too many tokens", since the semicolon is seen as a token separator. If I try to escape or encode it (e.g. as "%3B" or "\;"), the attachment is created with precisely this name, including the escape character ("file\;name.jpg").

So, my question is: Is this even possible? If yes, how? Or do I have to rename the file and all references to it? Any help is very much appreciated.

Florian

1 answer

1 accepted

1 vote
Answer accepted
Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 17, 2016

You need to quote the string "file;name.jpg".

Thate should work.

Florian Fahrenberger February 17, 2016

Wow, that was a very quick answer, thanks. I tried a lot of quoting and escaping and did not get into all of it in my problem description. Pushed by your idea though, I tried a few more things, but all of them failed. The error message I get from your suggestion is the same:

Cannot parse '2015-10-01 14:30:00;UserName;"file;name.txt";file://///path/file%3Bname.txt' as attachment info: too many tokens

A problem is that the string inside the CSV file obviously also needs to be quoted with " or ', in case there is the cell separator character in there, like ";" or ",". So it's an escape-nightmare... But trust me, I have tried escaping via

"file;name"
\"file;name\"
'file;name'
""file;name""
file\;name
"file\;name"
et cetera...

I will probably give this another hour or so before I switch to renaming the attachments. Since all the export from the old database is scripted anyways, it won't be too much trouble. I just wanted to preserve the original file names, since this sometimes plays a role in bugs.

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 17, 2016

Sorry to hear that.

What about switching the separator from ";" to someting else e.g. "|" . Maybe that can help.

Florian Fahrenberger February 18, 2016

Actually, I found the unicode character "greek question mark" which actually is the canonically identical character in Unicode, but has a different number code (U+037E instead of U+003B). So it looks exactly the same but works on import. Without any escaping that is, so the importer actually works really well picking up every possible weird unicode character and only filtering out the semicolon, no matter how I try to escape it.

The problem why I hesitate is: On one bug, a developer actually found a hickup in our software if the file name contains a semicolon. So, I would rather have liked to preserve the original character, because if a developer ever downloads this file, there is no way he/she is going to notice that this is not a semicolon in the file name... opening up a horrible can of worms. wink

Well, I will give it a couple more swings. If I find a solution, I will certainly post it here in case others face the same issue.

Update: I could not comment anymore yesterday (beginner's restriction), but I probably will not go and resolve this issue. I found out that out of the 50k bugs I want to import, only 8 contain a semicolon in the file name. So I will just fix those manually after import... smile

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2016

If it are only 8 making you trouble, import those without attachment and attach the files later on manually.

Florian Fahrenberger February 18, 2016

Yes, that's exactly what I'm going for now. Apparently, semicolons in filenames aren't too common, luckily. And most of them are just winky smileys which I would have replaced without hesitation. smile So I guess this problem is not too common and doesn't need fixing.

But I am still baffled how well the CSV import transfers every character, including the usual escape characters, into the file name, and the only character that has given me any trouble (since it is the token separator) is the semicolon.

Thanks anyways, I will mark this as the answer, since with the long line of comments, one can figure out that this is probably not fixable on the user side.

Suggest an answer

Log in or Sign up to answer