### Eclipse Workspace Patch 1.0 #P sakai_2-6-x Index: msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp =================================================================== --- msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp (revision 62635) +++ msgcntr/messageforums-app/src/webapp/jsp/discussionForum/message/dfViewThreadBodyInclude.jsp (working copy) @@ -49,9 +43,9 @@ - - - + + + Index: msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java =================================================================== --- msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java (revision 62635) +++ msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java (working copy) @@ -20,6 +20,7 @@ **********************************************************************************/ package org.sakaiproject.component.app.messageforums; +import java.net.URLEncoder; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; @@ -31,6 +32,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -1038,10 +1041,19 @@ { try { - String tempString = contentHostingService.getResource(id).getUrl(false); - //url escaping the sting can break it - //String newString = org.sakaiproject.util.Web.escapeUrl(tempString); - return tempString; + String link = contentHostingService.getResource(id).getUrl(false); + Pattern pattern = Pattern.compile("^(https?://[^/]+)(.+/)([^/]+)$"); + Matcher matcher = pattern.matcher(link); + + if(matcher.matches()){ + String host = matcher.group(1); + String path = matcher.group(2).replace(" ", "%20"); + String file = matcher.group(3); + String encoded = URLEncoder.encode(file, "UTF-8").replace("+", "%20"); + return (host + path + encoded); + }else{ + return link; + } } catch(Exception e) {