Browse Source

Optimize symbolic links checking

adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
ee38124db7
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/webui/webapplication.cpp

6
src/webui/webapplication.cpp

@ -157,8 +157,10 @@ void WebApplication::sendWebUIFile()
if (!Utils::Fs::isRegularFile(localPath)) if (!Utils::Fs::isRegularFile(localPath))
throw InternalServerErrorHTTPError(tr("Unacceptable file type, only regular file is allowed.")); throw InternalServerErrorHTTPError(tr("Unacceptable file type, only regular file is allowed."));
QFileInfo fileInfo {localPath.data()}; const QString rootFolder = m_rootFolder.data();
while (Path(fileInfo.filePath()) != m_rootFolder)
QFileInfo fileInfo {localPath.parentPath().data()};
while (fileInfo.path() != rootFolder)
{ {
if (fileInfo.isSymLink()) if (fileInfo.isSymLink())
throw InternalServerErrorHTTPError(tr("Symlinks inside alternative UI folder are forbidden.")); throw InternalServerErrorHTTPError(tr("Symlinks inside alternative UI folder are forbidden."));

Loading…
Cancel
Save