From a73a1fb0973484acde129651c26d06f2380ac19d Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 30 Sep 2009 15:53:06 +0000 Subject: [PATCH] dont set ipath for the first page in text files to avoid dual records for files under the page size --- src/internfile/mh_text.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/internfile/mh_text.cpp b/src/internfile/mh_text.cpp index 32cdb1c8..d7f742f9 100644 --- a/src/internfile/mh_text.cpp +++ b/src/internfile/mh_text.cpp @@ -128,10 +128,17 @@ bool MimeHandlerText::next_document() m_havedoc = false; return true; } else { - // Paging: set ipath then read next chunk + // Paging: set ipath then read next chunk. + + // Don't set ipath for the first chunk to avoid having 2 + // records for small files (one for the file, one for the + // first chunk). This is a hack. The right thing to do would + // be to use a different mtype for files over the page size, + // and keep text/plain only for smaller files. char buf[20]; sprintf(buf, "%lld", m_offs - m_text.length()); - m_metaData["ipath"] = buf; + if (m_offs - m_text.length() != 0) + m_metaData["ipath"] = buf; readnext(); return true; }