From 30e2f1e514cfb97aed8d90a54e9cb3ce974ed70f Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Mon, 5 Nov 2012 11:50:09 +0100 Subject: [PATCH] [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 --- src/libkbibtexio/fileimporterbibtex.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) { -- 2.30.2