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
This commit is contained in:
Richard Heck 2010-12-09 17:55:11 +00:00
parent c51838d3c9
commit c0bb9707cb
3 changed files with 1 additions and 27 deletions

View File

@ -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, bool Formats::view(Buffer const & buffer, FileName const & filename,
string const & format_name) const string const & format_name) const
{ {

View File

@ -143,8 +143,6 @@ public:
void setViewer(std::string const & name, std::string const & command); void setViewer(std::string const & name, std::string const & command);
/// ///
void setEditor(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. /// View the given file. Buffer used for DVI's paper orientation.
bool view(Buffer const & buffer, support::FileName const & filename, bool view(Buffer const & buffer, support::FileName const & filename,
std::string const & format_name) const; std::string const & format_name) const;

View File

@ -100,10 +100,7 @@ bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetHyperlink::viewTarget() const void InsetHyperlink::viewTarget() const
{ {
if (getParam("type").empty()) if (getParam("type") == "file:") {
formats.viewURL(getParam("target"));
else if (getParam("type") == "file:") {
FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath()); FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath());
string const format = formats.getFormatFromFile(url); string const format = formats.getFormatFromFile(url);
formats.view(buffer(), url, format); formats.view(buffer(), url, format);