From d00142d1cd667604dd97cf3c5fec91acfc829a4a Mon Sep 17 00:00:00 2001 From: kelson42 Date: Mon, 23 Apr 2012 11:15:32 +0000 Subject: [PATCH] small improvement of getHumanReadableIdFromPath() --- src/common/kiwix/library.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/kiwix/library.cpp b/src/common/kiwix/library.cpp index 7e9ec1a2c..4aa7ae65b 100644 --- a/src/common/kiwix/library.cpp +++ b/src/common/kiwix/library.cpp @@ -61,10 +61,13 @@ namespace kiwix { std::string Book::getHumanReadableIdFromPath() { std::string id = path; - removeAccents(id); - replaceRegex(id, "", "^.*/"); - replaceRegex(id, "", "\\.zim[a-z]*$"); - replaceRegex(id, "_", " "); + if (!id.empty()) { + removeAccents(id); + replaceRegex(id, "", "^.*/"); + replaceRegex(id, "", "\\.zim[a-z]*$"); + replaceRegex(id, "_", " "); + replaceRegex(id, "plus", "\\+"); + } return id; }