Author: rgheck
Date: Thu Dec 9 18:55:11 2010
New Revision: 36789
URL: http://www.lyx.org/trac/changeset/36789
Log:
Remove support for viewing URLs from hyperlinks. This is a security
risk, due to our lack of control over the links and the program used to
view them.
Modified:
lyx-devel/trunk/src/Format.cpp
lyx-devel/trunk/src/Format.h
lyx-devel/trunk/src/insets/InsetHyperlink.cpp
Modified: lyx-devel/trunk/src/Format.cpp
==============================================================================
--- lyx-devel/trunk/src/Format.cpp Thu Dec 9 14:01:59 2010 (r36788)
+++ lyx-devel/trunk/src/Format.cpp Thu Dec 9 18:55:11 2010 (r36789)
@@ -260,27 +260,6 @@
}
-bool Formats::viewURL(docstring const & url) {
- Format const * format = getFormat("html");
- if (!format)
- return false;
-
- string command = libScriptSearch(format->viewer());
-
- if (!contains(command, token_from_format))
- command += ' ' + token_from_format;
- command = subst(command, token_from_format, quoteName(to_utf8(url)));
-
- LYXERR(Debug::FILES, "Executing command: " << command);
-
- Systemcall one;
- one.startscript(Systemcall::DontWait, command);
-
- // we can't report any sort of error, since we aren't waiting
- return true;
-}
-
-
bool Formats::view(Buffer const & buffer, FileName const & filename,
string const & format_name) const
{
Modified: lyx-devel/trunk/src/Format.h
==============================================================================
--- lyx-devel/trunk/src/Format.h Thu Dec 9 14:01:59 2010 (r36788)
+++ lyx-devel/trunk/src/Format.h Thu Dec 9 18:55:11 2010 (r36789)
@@ -143,8 +143,6 @@
void setViewer(std::string const & name, std::string const & command);
///
void setEditor(std::string const & name, std::string const & command);
- /// Currently used by hyperlink insets and GuiCitation
- bool viewURL(docstring const & url);
/// View the given file. Buffer used for DVI's paper orientation.
bool view(Buffer const & buffer, support::FileName const & filename,
std::string const & format_name) const;
Modified: lyx-devel/trunk/src/insets/InsetHyperlink.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetHyperlink.cpp Thu Dec 9 14:01:59
2010 (r36788)
+++ lyx-devel/trunk/src/insets/InsetHyperlink.cpp Thu Dec 9 18:55:11
2010 (r36789)
@@ -100,10 +100,7 @@
void InsetHyperlink::viewTarget() const
{
- if (getParam("type").empty())
- formats.viewURL(getParam("target"));
-
- else if (getParam("type") == "file:") {
+ if (getParam("type") == "file:") {
FileName url = makeAbsPath(to_utf8(getParam("target")),
buffer().filePath());
string const format = formats.getFormatFromFile(url);
formats.view(buffer(), url, format);