--- a/src/index/fsfetcher.cpp
+++ b/src/index/fsfetcher.cpp
@@ -31,7 +31,8 @@
using std::string;
-static bool urltopath(const Rcl::Doc& idoc, string& fn, struct stat& st)
+static bool urltopath(RclConfig* cnf,
+ const Rcl::Doc& idoc, string& fn, struct stat& st)
{
// The url has to be like file://
if (idoc.url.find(cstr_fileu) != 0) {
@@ -40,7 +41,11 @@
return false;
}
fn = idoc.url.substr(7, string::npos);
- if (stat(fn.c_str(), &st) < 0) {
+ cnf->setKeyDir(path_getfather(fn));
+ bool follow = false;
+ cnf->getConfParam("followLinks", &follow);
+
+ if ((follow ? stat(fn.c_str(), &st) : lstat(fn.c_str(), &st))< 0) {
LOGERR(("FSDocFetcher::fetch: stat errno %d for [%s]\n",
errno, fn.c_str()));
return false;
@@ -51,7 +56,7 @@
bool FSDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
{
string fn;
- if (!urltopath(idoc, fn, out.st))
+ if (!urltopath(cnf, idoc, fn, out.st))
return false;
out.kind = RawDoc::RDK_FILENAME;
out.data = fn;
@@ -62,7 +67,7 @@
{
string fn;
struct stat st;
- if (!urltopath(idoc, fn, st))
+ if (!urltopath(cnf, idoc, fn, st))
return false;
FsIndexer::makesig(&st, sig);
return true;