Janne --

I've been looking into a bug in JSPWikiMarkupParser that looks like it
is responsible for like ~50 of our failing unit tests. It's a little
tricky, and I'd like some guidance before I do much more.

Basically, the method AttachmentManager.getAttachmentInfo(
WikiContext,String,int) wasn't checking to see if something like
[Hyperlink] was actually an attachment. I've got a 1-line fix in
AttachmentManager that helps. Here's the NEW code, at line 210.
Specifically, the "att != null && att.isAttachment()" bits seem to do
the trick.

        if( att == null )
        {
            att = m_engine.getContentManager().getPage( name, version );
            if ( att != null && att.isAttachment() )
            {
                return att;
            }
        }

        return null;

HOWEVER, the unit test still fail because the unit tests expect
hyperlinks like this:

/Wiki.jsp?page=Hyperlink

...but what we get is this:

/Wiki.jsp?page=Main%3AHyperlink

So, this begs two quick questions. First, are generated links of
Main:Hyperlink correct? Should we just create a special case and agree
that anything in the default space shouldn't have the space prepended?
(I think this is cheating, and would prefer to prepend Main: to the
expected URLs in the tests.)

Second, what about URL generation? Creating URLs where the colon is
uuencoded looks pretty fugly. On the other hand, it might be more
trouble than it's worth to not encode the colon.

Thoughts?

Andrew

Reply via email to