From c0bb9707cb1b9c0fa307f1a030b5a8657f2c21fc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 9 Dec 2010 17:55:11 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36789 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Format.cpp | 21 --------------------- src/Format.h | 2 -- src/insets/InsetHyperlink.cpp | 5 +---- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/Format.cpp b/src/Format.cpp index 7d495b7aa9..050af1414f 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -260,27 +260,6 @@ void Formats::setEditor(string const & name, string const & command) } -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 { diff --git a/src/Format.h b/src/Format.h index 3737f4c452..445c11b024 100644 --- a/src/Format.h +++ b/src/Format.h @@ -143,8 +143,6 @@ public: 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; diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp index 7a293ff8a4..42dd6917dd 100644 --- a/src/insets/InsetHyperlink.cpp +++ b/src/insets/InsetHyperlink.cpp @@ -100,10 +100,7 @@ bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd, 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);