mirror of https://github.com/kiwix/libkiwix.git
Fix nameMapper initialization.
This commit is contained in:
parent
a8668db2fe
commit
d90a27af11
|
@ -35,10 +35,13 @@ HumanReadableNameMapper::HumanReadableNameMapper(kiwix::Library& library, bool w
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto aliasName = replaceRegex(bookName, "", "_[[:digit:]]{4}-[[:digit:]]{2}$");
|
auto aliasName = replaceRegex(bookName, "", "_[[:digit:]]{4}-[[:digit:]]{2}$");
|
||||||
|
if (aliasName == bookName) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (m_nameToId.find(aliasName) == m_nameToId.end()) {
|
if (m_nameToId.find(aliasName) == m_nameToId.end()) {
|
||||||
m_nameToId[aliasName] = bookId;
|
m_nameToId[aliasName] = bookId;
|
||||||
} else {
|
} else {
|
||||||
auto alreadyPresentPath = library.getBookById(aliasName).getPath();
|
auto alreadyPresentPath = library.getBookById(m_nameToId[aliasName]).getPath();
|
||||||
std::cerr << "Path collision: " << alreadyPresentPath
|
std::cerr << "Path collision: " << alreadyPresentPath
|
||||||
<< " and " << currentBook.getPath()
|
<< " and " << currentBook.getPath()
|
||||||
<< " can't share the same URL path '" << aliasName << "'."
|
<< " can't share the same URL path '" << aliasName << "'."
|
||||||
|
|
Loading…
Reference in New Issue