discovery: Make the unknown file extensions read-only.

Change-Id: Ie1467334868a7e4aa31aa69f67d0cd434ed18e7b
Reviewed-on: https://gerrit.libreoffice.org/40083
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
This commit is contained in:
Jan Holesovsky 2017-07-17 19:59:46 +02:00
parent af13e5927d
commit 92cdab8bf8
2 changed files with 5 additions and 5 deletions

View file

@ -553,7 +553,7 @@ std::string LOOLWSD::LOKitVersion;
std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml"; std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml";
Util::RuntimeConstant<bool> LOOLWSD::SSLEnabled; Util::RuntimeConstant<bool> LOOLWSD::SSLEnabled;
Util::RuntimeConstant<bool> LOOLWSD::SSLTermination; Util::RuntimeConstant<bool> LOOLWSD::SSLTermination;
std::set<std::string> LOOLWSD::ViewFileExtensions; std::set<std::string> LOOLWSD::EditFileExtensions;
static std::string UnitTestLibrary; static std::string UnitTestLibrary;
@ -2233,8 +2233,8 @@ private:
elem->setAttribute(urlsrc, uriValue); elem->setAttribute(urlsrc, uriValue);
// Set the View extensions cache as well. // Set the View extensions cache as well.
if (elem->getAttribute("name") == "view") if (elem->getAttribute("name") == "edit")
LOOLWSD::ViewFileExtensions.insert(elem->getAttribute("ext")); LOOLWSD::EditFileExtensions.insert(elem->getAttribute("ext"));
} }
std::ostringstream ostrXML; std::ostringstream ostrXML;

View file

@ -55,7 +55,7 @@ public:
static std::atomic<unsigned> NumConnections; static std::atomic<unsigned> NumConnections;
static bool TileCachePersistent; static bool TileCachePersistent;
static std::unique_ptr<TraceFileWriter> TraceDumper; static std::unique_ptr<TraceFileWriter> TraceDumper;
static std::set<std::string> ViewFileExtensions; static std::set<std::string> EditFileExtensions;
/// Flag to shutdown the server. /// Flag to shutdown the server.
std::atomic<bool> ShutdownFlag; std::atomic<bool> ShutdownFlag;
@ -85,7 +85,7 @@ public:
/// Return truee iff extension is marked as view action in discovery.xml. /// Return truee iff extension is marked as view action in discovery.xml.
static bool IsViewFileExtension(const std::string& extension) static bool IsViewFileExtension(const std::string& extension)
{ {
return ViewFileExtensions.find(extension) != ViewFileExtensions.end(); return EditFileExtensions.find(extension) == EditFileExtensions.end();
} }
/// Returns the value of the specified application configuration, /// Returns the value of the specified application configuration,