AnsweredAssumed Answered

Escaped Share URL breaks TinyMCE on Safari

Question asked by jpotts Moderator on Jan 6, 2011
Latest reply on Jan 7, 2011 by mikeh
In Alfresco Community 3.4, when a user logs in, here is their dashboard URL:

http://localhost:8081/share/page/user/tuser3@jpotts.metaversant-laptop.com/dashboard

Notice the "@" sign. In this case, we're using email address as the user id.

Here's the problem. Suppose you have a Share URL that looks like the one above and you try to use the TinyMCE editor. The JS includes appear to use the URL context to import the TinyMCE JavaScript, but they break because of the "@" sign.

In our case this happens when someone clicks the Dashboard link (which contains the @, out of the box) and manages a workflow task. We have a custom extension that invokes a SimpleDialog to let the user edit content. If that content is HTML, and if the user has an @ in their username, the editor does not show up. To fix this, we modified the header.get.html.ftl file to replace the @ sign in the userid token. This keeps the @ sign out of the URL and fixes the problem for Firefox and Chrome, but not Safari 5.

You can try this yourself without our workflow customizations. Go do an inline edit on a piece of HTML content in your Share site. Your URL will look something like this:

http://localhost:8081/share/page/site/testsite1/inline-edit?nodeRef=workspace://SpacesStore/13a55691-33ae-4e0e-888f-8c0325adf074

Now change the URL to:

http://localhost:8081/share/page/user/foo@bar.com/inline-edit?nodeRef=workspace://SpacesStore/13a55691-33ae-4e0e-888f-8c0325adf074

The rich text editor breaks. If you look at the browser console, the Surf dispatcher servlet is having trouble rendering the view.

javax.servlet.ServletException: Could not resolve view with name 'user/foo@localhost:8081/share/res/modules/editors/tiny_mce/langs/en.js' in servlet with name 'Spring Surf Dispatcher Servlet'
   org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1042)
   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
   org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
   org.alfresco.web.scripts.servlet.StaticAssetCacheFilter.doFilter(StaticAssetCacheFilter.java:70)
   org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:301)

If you change the URL to:

http://localhost:8081/share/page/user/foo%40bar.com/inline-edit?nodeRef=workspace://SpacesStore/13a55691-33ae-4e0e-888f-8c0325adf074

The rich text editor works, but only in Firefox and Chrome. Safari still breaks with the same error. It's almost like when Safari does the include, it is unescaping the URL string whereas Firefox and Chrome do the include with the @ sign escaped. Anyone seen this?

Outcomes