Browse files

WL-2295 Fix URL handling of unencoded spaces

Currently URLs are not being encoded when they are first stashed. Since
this is the case it causes an invalid URI when decoding the short URL.
In many cases this will cause a Illegal Argument Exception and interrupt
processing: e.g. this was caught in rewriting html content when copying
a site.

Really we should fix the original encoding problem in the first place, but
this fix for space encodings should fix the lion's share of failures. I
mean WebLearn users only use ascii right? Right?
  • Loading branch information...
Ben Holmes
Ben Holmes committed Nov 18, 2013
1 parent 904dd2a commit 096ac44842f7e1975cd6f97e119c1816c366c600
Showing with 2 additions and 1 deletion.
  1. +2 −1 impl/src/java/org/sakaiproject/shortenedurl/impl/
@@ -41,7 +41,8 @@ public void init() {
public boolean isUrlHandled(String url) {
- URI uri = URI.create(url);
+ // generally the stored URLs are not encoded correctly, manually encode spaces as a quick fix
+ URI uri = URI.create(url.replace(" ", "%20"));
return (isLocalUri(uri) && PATH_PATTERN.matcher(uri.getPath()).matches());

0 comments on commit 096ac44

Please sign in to comment.