Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-4211

Cannot edit page containing a redirection

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • 2.0 M3
    • WYSIWYG Editor
    • None
    • redirect
    • Low
    • Hard

    Description

      To reproduce, create a page with this content:

      $response.sendRedirect($xwiki.getURL("Sandbox.WebHome")
      

      Now, since this page redirects it's hard to edit, so manually modify the URL for this page and put "edit" instead of "view". Now you'll be in the wysiwyg editor but the page cannot be editer. If you go in the source tab you'll even see the full HTML for the page you're redirected to.

      I think that's because the wysiwyg editor executes the redirect. That's a difficult and general pb if we have code in velocity that changes things. There might be cases other than the redirect one.

      Any idea of what we can do?

      Not that to be able to edit the page I had to change my user's default editor to be the "text" one.

      Attachments

        Issue Links

          Activity

            [XWIKI-4211] Cannot edit page containing a redirection
            GOhrner Gunter Ohrner added a comment -

            Ah, good adjustment.

            GOhrner Gunter Ohrner added a comment - Ah, good adjustment.
            vmassol Vincent Massol added a comment -

            Ah yes you're right actually, sorry. I've fixed the FAQ page and added some more precisions: https://www.xwiki.org/xwiki/bin/view/FAQ/How%20do%20I%20remove%20a%20redirect?viewer=changes&rev1=5.1&rev2=6.1

            Thx

            vmassol Vincent Massol added a comment - Ah yes you're right actually, sorry. I've fixed the FAQ page and added some more precisions: https://www.xwiki.org/xwiki/bin/view/FAQ/How%20do%20I%20remove%20a%20redirect?viewer=changes&rev1=5.1&rev2=6.1 Thx
            GOhrner Gunter Ohrner added a comment - - edited

            Well, as I wrote, you cannot see the edit menu on a redirect page...

            The "editor toggle menu" you get in advanced mode won't help, as - well, you'll be redirected, so you won't see it for the redirection page.

            Or am I still getting it wrong, or do I miss something obvious?

            GOhrner Gunter Ohrner added a comment - - edited Well, as I wrote, you cannot see the edit menu on a redirect page... The "editor toggle menu" you get in advanced mode won't help, as - well, you'll be redirected, so you won't see it for the redirection page. Or am I still getting it wrong, or do I miss something obvious?
            vmassol Vincent Massol added a comment -

            Edit > Wiki....

            vmassol Vincent Massol added a comment - Edit > Wiki....
            GOhrner Gunter Ohrner added a comment -

            Just edit in wiki mode and edit the redirect That's really the simplest IMO. Much simpler than editing in the wysiwyg editor and changing the default editor and simpler than manually changing the URL too.

            I still don't get it - how would I do it in advanced mode?

            GOhrner Gunter Ohrner added a comment - Just edit in wiki mode and edit the redirect That's really the simplest IMO. Much simpler than editing in the wysiwyg editor and changing the default editor and simpler than manually changing the URL too. I still don't get it - how would I do it in advanced mode?
            vmassol Vincent Massol added a comment -

            I'm always using advanced mode, but I'm not sure how this should help for editing redirects? If you're referring to chosing the Wiki editor as the default editor in the user's preferences, you should probably mention this.

            Just edit in wiki mode and edit the redirect That's really the simplest IMO. Much simpler than editing in the wysiwyg editor and changing the default editor and simpler than manually changing the URL too.

            Maybe you should upgrade such that this isn't the first impression someone interested in XWiki gets about the software...

            Sure, it needs to be done.

            vmassol Vincent Massol added a comment - I'm always using advanced mode, but I'm not sure how this should help for editing redirects? If you're referring to chosing the Wiki editor as the default editor in the user's preferences, you should probably mention this. Just edit in wiki mode and edit the redirect That's really the simplest IMO. Much simpler than editing in the wysiwyg editor and changing the default editor and simpler than manually changing the URL too. Maybe you should upgrade such that this isn't the first impression someone interested in XWiki gets about the software... Sure, it needs to be done.
            GOhrner Gunter Ohrner added a comment -

            Thanks. I've made some minor edits and switched the order (to list first the preferred strategy for redirects).

            Ok. In this page, you wrote:

            Alternatively, you can switch your user to be an Advanced User and then edit in wiki mode.

            I'm always using advanced mode, but I'm not sure how this should help for editing redirects? If you're referring to chosing the Wiki editor as the default editor in the user's preferences, you should probably mention this.

            The "editor toggle menu" you get in advanced mode won't help, as - well, you'll be redirected, so you won't see it for the redirection page.

            https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2

            Try without the section editing. Apparently there's a problem. Since XWiki.org is on an old version of XWiki it's likely to have been fixed.

            Worked, thanks.

            Apparently, the instance doesn't support section editing. It's also using a plain HTML text area as its editor component, at least by default - no WYSIWYG and no nice Wiki editor with syntax highlighting...

            Maybe you should upgrade such that this isn't the first impression someone interested in XWiki gets about the software...

            GOhrner Gunter Ohrner added a comment - Thanks. I've made some minor edits and switched the order (to list first the preferred strategy for redirects). Ok. In this page, you wrote: Alternatively, you can switch your user to be an Advanced User and then edit in wiki mode. I'm always using advanced mode, but I'm not sure how this should help for editing redirects? If you're referring to chosing the Wiki editor as the default editor in the user's preferences, you should probably mention this. The "editor toggle menu" you get in advanced mode won't help, as - well, you'll be redirected, so you won't see it for the redirection page. https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2 Try without the section editing. Apparently there's a problem. Since XWiki.org is on an old version of XWiki it's likely to have been fixed. Worked, thanks. Apparently, the instance doesn't support section editing. It's also using a plain HTML text area as its editor component, at least by default - no WYSIWYG and no nice Wiki editor with syntax highlighting... Maybe you should upgrade such that this isn't the first impression someone interested in XWiki gets about the software...
            vmassol Vincent Massol added a comment -

            Thanks. I've made some minor edits and switched the order (to list first the preferred strategy for redirects).

            bq https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2

            Try without the section editing. Apparently there's a problem. Since XWiki.org is on an old version of XWiki it's likely to have been fixed.

            vmassol Vincent Massol added a comment - Thanks. I've made some minor edits and switched the order (to list first the preferred strategy for redirects). bq https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2 Try without the section editing. Apparently there's a problem. Since XWiki.org is on an old version of XWiki it's likely to have been fixed.
            GOhrner Gunter Ohrner added a comment -

            I changes the "remove a redirect" FAQ entry:

            https://www.xwiki.org/xwiki/bin/view/FAQ/How%20do%20I%20remove%20a%20redirect

            Not sure about a separate "edit a redirect" entry, as the procedure for editing and removing a macro based redirect is basically the same, I think...
            Feel free to change this, however.

            I also wanted to adjust the link from the "change homepage" page to the modified FAQ entry, but just got an Exception:

            https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2

            Detailed information:
                Error number 0 in 11: Uncaught exception
            com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception
            	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:474)
            	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:210)
            	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
            	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
            	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
            	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
            	at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
            	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:136)
            	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
            	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
            	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
            	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
            	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
            	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
            	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
            	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
            	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
            	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
            	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190)
            	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
            	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            	at java.lang.Thread.run(Thread.java:748)
            Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
            	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
            	at java.util.ArrayList.get(ArrayList.java:433)
            	at com.xpn.xwiki.doc.XWikiDocument.getDocumentSection(XWikiDocument.java:7845)
            	at com.xpn.xwiki.web.EditAction.updateDocumentTitleAndContentFromRequest(EditAction.java:224)
            	at com.xpn.xwiki.web.EditAction.prepareEditedDocument(EditAction.java:96)
            	at com.xpn.xwiki.web.EditAction.render(EditAction.java:59)
            	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:447)
            	... 45 more
            

            Not sure what went wrong, but so I wasn't able to update the link there.

            GOhrner Gunter Ohrner added a comment - I changes the "remove a redirect" FAQ entry: https://www.xwiki.org/xwiki/bin/view/FAQ/How%20do%20I%20remove%20a%20redirect Not sure about a separate "edit a redirect" entry, as the procedure for editing and removing a macro based redirect is basically the same, I think... Feel free to change this, however. I also wanted to adjust the link from the "change homepage" page to the modified FAQ entry, but just got an Exception: https://www.xwiki.org/xwiki/bin/edit/FAQ/How%20to%20change%20the%20home%20page%20destination?section=2 Detailed information: Error number 0 in 11: Uncaught exception com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:474) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:210) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:136) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:657) at java.util.ArrayList.get(ArrayList.java:433) at com.xpn.xwiki.doc.XWikiDocument.getDocumentSection(XWikiDocument.java:7845) at com.xpn.xwiki.web.EditAction.updateDocumentTitleAndContentFromRequest(EditAction.java:224) at com.xpn.xwiki.web.EditAction.prepareEditedDocument(EditAction.java:96) at com.xpn.xwiki.web.EditAction.render(EditAction.java:59) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:447) ... 45 more Not sure what went wrong, but so I wasn't able to update the link there.
            GOhrner Gunter Ohrner added a comment - - edited

            Sorry, hadn't had time so far to add the stuff to this page...

            However, I just stumbled accross the XWiki 11.5 release notes and noted the new "restricted" URL parameter. I assume this should also help to disable the velocity-based redirections? Does restricted mode also work in WYSIWYG edit mode?

            https://www.xwiki.org/xwiki/bin/view/ReleaseNotes/Data/XWiki/11.5#HMiscellaneous (this is supposed to reference the Developer's "Miscellaneous" section, even though it does not. See also https://forum.xwiki.org/t/page-internal-section-links-toc-links-in-case-of-duplicate-section-names/5153)

            GOhrner Gunter Ohrner added a comment - - edited Sorry, hadn't had time so far to add the stuff to this page... However, I just stumbled accross the XWiki 11.5 release notes and noted the new " restricted " URL parameter. I assume this should also help to disable the velocity-based redirections? Does restricted mode also work in WYSIWYG edit mode? https://www.xwiki.org/xwiki/bin/view/ReleaseNotes/Data/XWiki/11.5#HMiscellaneous (this is supposed to reference the Developer's "Miscellaneous" section, even though it does not. See also https://forum.xwiki.org/t/page-internal-section-links-toc-links-in-case-of-duplicate-section-names/5153 )

            People

              Unassigned Unassigned
              vmassol Vincent Massol
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: