Change kiwix::fileExists to kiwix::fileReadable

This commit is contained in:
Nikhil Tanwar 2022-01-03 22:35:17 +05:30 committed by Emmanuel Engelhart
parent b974e121b4
commit 74d3bffde0

View File

@ -86,8 +86,8 @@ string loadCustomTemplate (string customIndexPath) {
customIndexPath = kiwix::isRelativePath(customIndexPath) ? customIndexPath = kiwix::isRelativePath(customIndexPath) ?
kiwix::computeAbsolutePath(kiwix::getCurrentDirectory(), customIndexPath) : kiwix::computeAbsolutePath(kiwix::getCurrentDirectory(), customIndexPath) :
customIndexPath; customIndexPath;
if (!kiwix::fileExists(customIndexPath)) { if (!kiwix::fileReadable(customIndexPath)) {
throw runtime_error("No such file exist (or file is not readable)" + customIndexPath); throw runtime_error("No such file exist (or file is not readable) " + customIndexPath);
} }
if (kiwix::getMimeTypeForFile(customIndexPath) != "text/html") { if (kiwix::getMimeTypeForFile(customIndexPath) != "text/html") {
throw runtime_error("Invalid File Mime Type " + kiwix::getMimeTypeForFile(customIndexPath)); throw runtime_error("Invalid File Mime Type " + kiwix::getMimeTypeForFile(customIndexPath));