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.
Yeah, the old way of checking for attachments was to either see if there is a "/" in the name somewhere, or instanceof Attachment. Both fail :-)
getAttachmentInfo() is more or less obsolete anyway - getPage() should take care of it.
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.)
That is a good question. I think we should make "remove default spacename" an user setting, and have it on for 3.0, and then off once we actually have wikispaces support (it looks to me that we might want to drop that from 3.0 and move it to 3.1). I'm not sure whether people expect their URLs to change (even though references won't break since we always go back to the default space).
BTW, is "Main" a good name for the default space?
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.
We're already using a custom encoder in TextUtil, so patching it to support colons should be pretty trivial.
/Janne
