|
3 | 3 | #include <QtCore/QProcess> |
4 | 4 | #include <QtCore/QSettings> |
5 | 5 | #include <QtCore/QLoggingCategory> |
| 6 | +#include <QtCore/QRegularExpression> |
6 | 7 | #include <QtGui/QWindow> |
7 | 8 | #include <QtNetwork/QNetworkProxyFactory> |
8 | 9 | #include <QtWidgets/QApplication> |
|
17 | 18 | #include <CoreApi/logger.h> |
18 | 19 | #include <CoreApi/translationmanager.h> |
19 | 20 |
|
| 21 | +#include <extensionsystem/pluginmanager.h> |
| 22 | +#include <extensionsystem/pluginspec.h> |
| 23 | + |
20 | 24 | #include <qjsonsettings.h> |
21 | 25 |
|
22 | 26 | #include <SVSCraftFluentSystemIcons/FluentSystemIconsImageProvider.h> |
|
26 | 30 | #include <application_config.h> |
27 | 31 | #include <application_buildinfo.h> |
28 | 32 |
|
| 33 | +#include <extensionsystem/pluginspec.h> |
| 34 | + |
29 | 35 | #ifdef APPLICATION_ENABLE_BREAKPAD |
30 | 36 | # include <QBreakpadHandler.h> |
31 | 37 | #endif |
@@ -119,6 +125,13 @@ class MyLoaderSpec : public Loader::LoaderSpec { |
119 | 125 | RuntimeInterface::translationManager()->addTranslationPath(translationBaseDir + QStringLiteral("/svscraft/translations")); |
120 | 126 | RuntimeInterface::translationManager()->addTranslationPath(translationBaseDir + QStringLiteral("/uishell/translations")); |
121 | 127 |
|
| 128 | + for (auto pluginSpec : ExtensionSystem::PluginManager::plugins()) { |
| 129 | + static QRegularExpression rx("^([a-z_][a-z0-9_]*)(\\.[a-z_][a-z0-9_]*)+$"); |
| 130 | + if (!rx.match(pluginSpec->name()).hasMatch()) { |
| 131 | + qFatal() << "Refused to load due to an invalid plugin name:" << pluginSpec->name() << "Plugin name should match" << rx.pattern(); |
| 132 | + } |
| 133 | + } |
| 134 | + |
122 | 135 | bool lastInitializationWarningSuppressed = QApplication::arguments().contains(kNoWarningLastInitialization); |
123 | 136 | if (settings->value("lastInitializationAbortedFlag").toBool() && !lastInitializationWarningSuppressed) { |
124 | 137 | qInfo() << "Last initialization was aborted abnormally"; |
|
0 commit comments