dont set ipath for the first page in text files to avoid dual records for files under the page size

This commit is contained in:
dockes 2009-09-30 15:53:06 +00:00
parent a374b2a7b7
commit a73a1fb097

View File

@ -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;
}