mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-22 21:53:03 +03:00
feat(core,registry): unmount HTTP server prefix on docset removal
This commit is contained in:
parent
6dc75311b4
commit
fc1f18f6c5
@ -90,6 +90,19 @@ QUrl HttpServer::mount(const QString &prefix, const QString &path)
|
||||
return mountUrl;
|
||||
}
|
||||
|
||||
bool HttpServer::unmount(const QString &prefix)
|
||||
{
|
||||
const QString pfx = sanitizePrefix(prefix);
|
||||
const bool ok = m_server->remove_mount_point(pfx.toUtf8());
|
||||
if (!ok) {
|
||||
qCWarning(log, "Failed to unmount '%s' to '%s'.", qPrintable(prefix), qPrintable(pfx));
|
||||
}
|
||||
|
||||
qCDebug(log, "Unmounted prefix '%s' ('%s').", qPrintable(prefix), qPrintable(pfx));
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
QString HttpServer::sanitizePrefix(const QString &prefix)
|
||||
{
|
||||
QString pfx = (prefix.startsWith(QLatin1String("/")) ? prefix.right(1) : prefix).toLower();
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
QUrl baseUrl() const;
|
||||
|
||||
QUrl mount(const QString &prefix, const QString &path);
|
||||
bool unmount(const QString &prefix);
|
||||
|
||||
private:
|
||||
static QString sanitizePrefix(const QString &prefix);
|
||||
|
@ -166,6 +166,7 @@ void DocsetRegistry::loadDocset(const QString &path)
|
||||
void DocsetRegistry::unloadDocset(const QString &name)
|
||||
{
|
||||
emit docsetAboutToBeUnloaded(name);
|
||||
Core::Application::instance()->httpServer()->unmount(name);
|
||||
delete m_docsets.take(name);
|
||||
emit docsetUnloaded(name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user