Fix nameMapper initialization. (#254)

Fix nameMapper initialization.
This commit is contained in:
Matthieu Gautier 2019-08-13 11:19:21 +02:00 committed by GitHub
commit 858c2fecbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -35,10 +35,13 @@ HumanReadableNameMapper::HumanReadableNameMapper(kiwix::Library& library, bool w
continue;
auto aliasName = replaceRegex(bookName, "", "_[[:digit:]]{4}-[[:digit:]]{2}$");
if (aliasName == bookName) {
continue;
}
if (m_nameToId.find(aliasName) == m_nameToId.end()) {
m_nameToId[aliasName] = bookId;
} else {
auto alreadyPresentPath = library.getBookById(aliasName).getPath();
auto alreadyPresentPath = library.getBookById(m_nameToId[aliasName]).getPath();
std::cerr << "Path collision: " << alreadyPresentPath
<< " and " << currentBook.getPath()
<< " can't share the same URL path '" << aliasName << "'."