From: Thomas Fischer Date: Mon, 5 Nov 2012 10:50:09 +0000 (+0100) Subject: [PATCH] Fix data loss with localfile field X-Git-Tag: archive/raspbian/0.9.90-1+rpi1~1^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=30e2f1e514cfb97aed8d90a54e9cb3ce974ed70f;p=kbibtex.git [PATCH] Fix data loss with localfile field Bibtex file with localfile field are destroyed by current kbibtex. If you create an article with your favorite editor: @article{test, author = "test", title = "test", journal = "test", year = 2012, localfile = "/tmp/test.pdf", } during loading the file kbibtex convert local file to http://test.pdf The following patch avoid this problem. bug-debian: http://bugs.debian.org/644024 Forwarded: http://gna.org/bugs/?20275 applied-upstream: 4.1 Gbp-Pq: Name 0005-Fix-data-loss-with-localfile-field.patch --- diff --git a/src/libkbibtexio/fileimporterbibtex.cpp b/src/libkbibtexio/fileimporterbibtex.cpp index 570a186..8c83d07 100644 --- a/src/libkbibtexio/fileimporterbibtex.cpp +++ b/src/libkbibtexio/fileimporterbibtex.cpp @@ -534,10 +534,12 @@ FileImporterBibTeX::Token FileImporterBibTeX::readValue(Value& value, const QStr if (isStringKey) value.append(new MacroKey(text)); else { - QList urls; - FileInfo::urlsInText(text, false, QString::null, urls); - for (QList::ConstIterator it = urls.constBegin(); it != urls.constEnd(); ++it) - value.append(new VerbatimText((*it).pathOrUrl())); + /// Assumption: in fields like Url or LocalFile, file names are separated by ; or , + static const QRegExp semicolonSpace = QRegExp("[;]\\s*"); + QStringList fileList = text.split(semicolonSpace, QString::SkipEmptyParts); + foreach(const QString &filename, fileList) { + value.append(new VerbatimText(filename)); + } } } else if (iKey == Entry::ftMonth) { if (isStringKey) {