Uploaded image for project: 'Confluence Server and Data Center'
  1. Confluence Server and Data Center
  2. CONFSERVER-31382

Link refactoring code wrongly attempts to expand links for String type (v1) macro parameters

    XMLWordPrintable

Details

    Description

      This problem was found when using the Scroll Versions plugin but it is actually a problem in the core Confluence product and can affect any macro usage during a refactoring even (such as Page move, update, etc).

      The resultant macro definition will be corrupted with a partial reference to the current page and as of Confluence 5.3.1 this will break rendering of the macro. Confluence 5.3.0 is tolerant of the broken XML and will still execute the macro.

          // We expect no change to a v1 macro parameter 
          public void testExpandRelativeLinkForV1MacroParamater() throws Exception
          {
              String content = "<ac:structured-macro ac:name=\"excerpt\"><ac:parameter ac:name=\"atlassian-macro-output-type\">BLOCK</ac:parameter><ac:rich-text-body><p>abc</p></ac:rich-text-body></ac:structured-macro>";
              
              BlogPost blog = new BlogPost();
              blog.setSpace(new Space("MKY"));
              blog.setTitle("Hello Dolly");
              blog.setBodyAsString(content);
              blog.setCreationDate(new Date());
      
              BlogPostResourceIdentifier ri = new BlogPostResourceIdentifier(blog.getSpaceKey(), blog.getTitle(), blog.getPostingCalendarDate());
              
              ConversionContext context = new DefaultConversionContext(blog.toPageContext());
              
              when(mockResourceIdentifierFactory.getResourceIdentifier(blog, context)).thenReturn(ri);
              when(mockResourceIdentifierMarshaller.marshal(ri, context)).thenReturn(Streamables.from("You shouldn't be seeing me in the output"));
              
              String result = updater.expandRelativeReferencesInContent(blog);
      
              assertStorageXmlEquals(content, result);
          }
      

      Attachments

        Issue Links

          Activity

            People

              pcurren Paul C
              pcurren Paul C
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: