Avoid replacing (instead of concatenating) the current author field value with the internal one when the document is a top-level one. This allows metadata from metadatacmds to be used
This commit is contained in:
parent
3a03fd68da
commit
0840daf20e
@ -28,9 +28,8 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#ifndef NO_NAMESPACES
|
||||
|
||||
using namespace std;
|
||||
#endif /* NO_NAMESPACES */
|
||||
|
||||
#include "cstr.h"
|
||||
#include "internfile.h"
|
||||
@ -550,6 +549,10 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc)
|
||||
// doc with an ipath, not the last one which is usually text/plain We
|
||||
// also set the author and modification time from the last doc which
|
||||
// has them.
|
||||
//
|
||||
// The stack can contain objects with an ipath element (corresponding
|
||||
// to actual embedded documents), and, at the top, elements without an
|
||||
// ipath element, corresponding to format translations of the last doc.
|
||||
//
|
||||
// The docsize is fetched from the first element without an ipath
|
||||
// (first non container). If the last element directly returns
|
||||
@ -579,7 +582,8 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
|
||||
const map<string, string>& docdata = (*hit)->get_meta_data();
|
||||
if (getKeyValue(docdata, cstr_dj_keyipath, ipathel)) {
|
||||
if (!ipathel.empty()) {
|
||||
// We have a non-empty ipath
|
||||
// Non-empty ipath. This stack element is for an
|
||||
// actual embedded document, not a format translation.
|
||||
hasipath = true;
|
||||
getKeyValue(docdata, cstr_dj_keymt, doc.mimetype);
|
||||
getKeyValue(docdata, cstr_dj_keyfn, doc.meta[Rcl::Doc::keyfn]);
|
||||
@ -593,8 +597,18 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
|
||||
getKeyValue(docdata, cstr_dj_keydocsize, doc.fbytes);
|
||||
doc.ipath += cstr_isep;
|
||||
}
|
||||
getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
|
||||
getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
|
||||
// We set the author field from the innermost doc which has
|
||||
// one: allows finding, e.g. an image attachment having no
|
||||
// metadata by a search on the sender name. Only do this for
|
||||
// actually embedded documents (avoid replacing values from
|
||||
// metacmds for the topmost one). For a topmost doc, author
|
||||
// will be merged by dijontorcl() later on. About same for
|
||||
// dmtime, but an external value will be replaced, not
|
||||
// augmented if dijontorcl() finds an internal value.
|
||||
if (hasipath) {
|
||||
getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
|
||||
getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
|
||||
}
|
||||
}
|
||||
|
||||
// Trim empty tail elements in ipath.
|
||||
@ -878,12 +892,6 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
|
||||
return FIAgain;
|
||||
}
|
||||
|
||||
// Temporary while we fix backend things
|
||||
static string urltolocalpath(string url)
|
||||
{
|
||||
return url.substr(7, string::npos);
|
||||
}
|
||||
|
||||
bool FileInterner::tempFileForMT(TempFile& otemp, RclConfig* cnf,
|
||||
const string& mimetype)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user