bug fix for one named month and day (webUi)

master
const an teen 2021-12-05 05:23:56 -05:00
parent 89f4174c39
commit a07b95fe92
1 changed files with 12 additions and 6 deletions

View File

@ -228,11 +228,17 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath)
month = getWordFromPath(urlPath);
month.remove(QRegularExpression("\\?.*$"));
if (not month.isEmpty() and fsPath.cd(month)) {
urlPath.remove(QRegularExpression("^.*/"+month));
day = getWordFromPath(urlPath);
day.remove(QRegularExpression("\\?.*$"));
if (not QFile::exists(fsPath.path()+global::slash+day+".txt")) {
day.clear();
if (urlPath.startsWith("/"+month+"/")) {
urlPath.remove(0,1);
int pos = urlPath.indexOf('/');
if (pos != -1) {
urlPath.remove(0,pos);
day = getWordFromPath(urlPath);
day.remove(QRegularExpression("\\?.*$"));
if (not QFile::exists(fsPath.path()+global::slash+day+".txt")) {
day.clear();
}
}
}
}
else { month.clear(); }
@ -454,7 +460,7 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath)
}
/* If you are reading this code, maybe you are crying now.
* Sorry me, man (woman/forgot/etc). Maybe I'll refactor this hell in the future.
* Sorry me, man (woman/fagot/etc). Maybe I'll refactor this hell in the future.
* acetone.
*/