Fix problems which occurred when using functions like open-parents with multiple indexes containing identical paths (udis)

This commit is contained in:
Jean-Francois Dockes
2013-05-25 11:26:57 +02:00
parent 11e0ccaa4e
commit a1b7018cfd
10 changed files with 99 additions and 59 deletions
+6 -10
View File
@@ -120,14 +120,12 @@ void FileInterner::reapXAttrs(const string& path)
// This is used when the user wants to retrieve a search result doc's parent
// (ie message having a given attachment)
bool FileInterner::getEnclosing(const string &url, const string &ipath,
string &eurl, string &eipath, string& udi)
bool FileInterner::getEnclosingUDI(const Rcl::Doc &doc, string& udi)
{
eurl = url;
eipath = ipath;
LOGDEB(("FileInterner::getEnclosingUDI(): url [%s] ipath [%s]\n",
doc.url.c_str(), doc.ipath.c_str()));
string eipath = doc.ipath;
string::size_type colon;
LOGDEB(("FileInterner::getEnclosing(): url [%s] ipath [%s]\n",
url.c_str(), eipath.c_str()));
if (eipath.empty())
return false;
if ((colon = eipath.find_last_of(cstr_isep)) != string::npos) {
@@ -135,10 +133,8 @@ bool FileInterner::getEnclosing(const string &url, const string &ipath,
} else {
eipath.erase();
}
make_udi(url_gpath(eurl), eipath, udi);
LOGDEB(("FileInterner::getEnclosing() after: [%s]\n", eipath.c_str()));
return true;
make_udi(url_gpath(doc.idxurl.empty() ? doc.url : doc.idxurl), eipath, udi);
}
string FileInterner::getLastIpathElt(const string& ipath)
+3 -3
View File
@@ -195,14 +195,14 @@ class FileInterner {
}
/**
* Get immediate parent for document.
* Get UDI for immediate parent for document.
*
* This is not in general the same as the "parent" document used
* with Rcl::Db::addOrUpdate(). The latter is the enclosing file,
* this would be for exemple the email containing the attachment.
* This is in internfile because of the ipath computation.
*/
static bool getEnclosing(const string &url, const string &ipath,
string &eurl, string &eipath, string& udi);
static bool getEnclosingUDI(const Rcl::Doc &doc, string& udi);
/** Return last element in ipath, like basename */
static std::string getLastIpathElt(const std::string& ipath);