New Message: Bug in manilaSuite.getPermalinkUrl

webmaster at userland.com webmaster at userland.com
Fri Feb 3 12:39:34 CST 2006


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$1612

By: Matt Deatherage (frontier at gcsf.com)

On my Manila 9.5 installation, manilaSuite.getPermalinkUrl returns true, and not a URL, if the address of the specified message is a story with no relative path in the site structure.

The code in question is after "else //story or DG message" after determining that the message in question is not a news item or archived home page:

else { //story or DG message
 if manilaSuite.discuss.isStory (adrmsg, adrsite) {
 local (relativePath = "");
 try { //try to get the relative path to the story
 relativePath = manilaSuite.siteStructure.getRelativePathToMessage (adrMsg^.msgNum, adrSite)};
 if relativePath == "" { //no path?
 local (storyreaderurl = adrsite^.["#urls"].storyReader);
 if not (storyreaderurl endswith "$");
 storyreaderurl = storyreaderurl + "$"; //HERE'S THE PROBLEM
 return (encodeWithAmpersands (storyreaderurl + adrmsg^.msgnum))}
 else { //there's a path, use the relative URL
 return (encodeWithAmpersands (siteurl + relativePath))}}
 else { //DG message […]

The line to add the "$" at the end of the URL if it's not already there is not indented under the previous "if" in my installation. This causes Frontier to stop executing statements in the current block, but all that's left in the routine are "else" blocks that won't execute either. The routine therefore never encounters a "return" statement and just returns true.

The fix is to indent the line commented "// HERE'S THE PROBLEM" above, so that the routine merely adds the "$" if necessary and then returns the encoded story reader URL.

(By the way: I've requested before that Manila not generate permalinks with "#" in them because anchors are just a crappy way to archive news items - even in most modern browsers, they often don't direct the reader's attention to the spot in question. I noticed while debugging that this routine is where that happens, so in my copy, I changed if manilaSuite.news.isNewsItem(adrmsg) to if false, so Manila will never generate those URLs I can't stand, or require them from TrackBack, etc. It would be really spiffy if there was a preference for this so I didn't have to modify the code. Anchor URLs are bad for archiving and must die.)

This is a Manila site... http://manila.userland.com/.




More information about the Manila-Users mailing list