Colons in linked files names

I have been using an old version of JabRef (which is an essential tool for my everyday activity, as well as for my students) for several reasons, including an easier way to link files. Testing version 5.x and now 6.0, on Linux Mint, I noticed that PDF and markdown files including a colon cannot be opened. I receive an error message:

  • for PDF files, I get “Unable to detect the URI-scheme of” ($file follows)
  • for markdown, the default programme opens (vim in my case), with an empty file and the message ($file) [New DIRECTORY]

A workaround would be easy, i.e. a symlink to any file containing a colon, for example link Author:Title.pdf to Author_Title.pdf. But i would like, if possible, not to add these otherwise unnecessary filenames to my already overcrowded directories…

Thanks a lot,
Guido (Northern Italy)

Hi,

Thanks for your report! The thing is JabRef uses colons as separator in the file field for
Title::FileType so this might be a problem here as well.
You could try to use JabRef’s Cleanup entries feature, to rename the files automatically.

Do you have an example bib entry where this happens?

Yes, thank you. I have a PDF file called Milanese:Varianti.pdf. In the old JabRef versions the PDF was called automatically clicking the PDF icon. Now I get the abovementioned error messge, while if I symlink to Milanese_Varianti.pdf (underscore or dash) it’s all right. For various reasons I do not want to use JabRef’s Cleanup entries feature (I refer to these files from other programmes). I have about 2300 pdf files linked to my databases, so the issue is quite important (I should add 2300 filenames).
Thank you for your kind attention!

Two questions about how JabRef parses the file names:

  • Can the file name be quoted in the .bib file to avoid unwanted parsing?
  • Is it possible to use a Java-style Unicode character reference (\u003a) in the .bib file in place of colons?

If character references work, then \u003a could be included in the naming pattern (in JabRef preferences) and @Guido_Milanese would not need to change his preferred naming system.

Update: I created a file named my:file.txt, then attached it to an entry in JabRef, and this was the result in my biblatex file.

  file                   = {:/path/to/my\:file.txt:Text},

It looks like you just need to add \ before the colon in your file names.

Regex search the .bib file for (^ file += \{:.*[^\\;]):(?!http|text|pdf|txt) and replace with $1\:

Update: The file field has a lot of variation. Try this search expression.

(^  file += \{.*[^0-9\\:;]):(?<!((\.\w{3,4})|pdf):)(?!http)

Replace with

$1\:

Update: Escaped backslashes do not work as expected. See comments below.

This did not happen the first time. I don’t know what changed.

Update: The file I tested initially not only attached successfully, but opened with a text editor as expected. However, this behaviour appears to be inconsistent and I could not replicate it at all with a PDF file.

Details:
On the second attempt, I could not attach the text file without renaming it, so I clicked “Rename and add”, then changed the bibtex source to include \: and then restored the original file name (containing :). The file opened successfully when clicked in the entry table, even though it appeared in orange (“File not found”) under the “General” tab.

Backslashes added in the source do not appear at all in graphical file names, while backslashes added in a graphical dialog convert to /\: in the source (and do not open).

It seems that colons cannot be used reliably in file names without adapting the code that JabRef uses to parse the file field.