From 10c2447aefb29bddf48799fb5a1631932a5940a8 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 26 Jun 2008 17:13:17 +0000 Subject: [PATCH] added URLEncoder.encode to properly escape CGI encoded arguments so they are safely transmitted to the launchApp servlet. --- src/jalview/appletgui/AlignFrame.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 530b9a0..d7c2b43 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -1037,7 +1037,16 @@ public class AlignFrame try { new URL(url); + url = URLEncoder.encode(url); } + /* When we finally deprecate 1.1 compatibility, + * we can start to use URLEncoder.encode(url,"UTF-8") + * and then we'll need this catch: + * catch (UnsupportedEncodingException ex) + { + System.err.println("WARNING - IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url); + ex.printStackTrace(); + } */ catch (java.net.MalformedURLException ex) { url = viewport.applet.getCodeBase() + url; -- 1.7.10.2