Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Bug? In build_title_linked

Quote Reply
Bug? In build_title_linked
There is a kind of problem in build_title_linked and (build.pm) whereby if there is a "/" [forward slash] in the title, then LSQL will assume that the section that comes before the slash constitutes a category, and as such will build an extra level for it, as such:

Category Name: Top/Semantics/Pronouns
Link Title: The strange seemed to have issues with his/her appearance

Subsequent title_linked result:

Top/Semantics/Pronouns/The_strange_seemed_to have_issues_with_his/her_appearance

In HTML:

Code:
<a href=/>Top</a> : <a href=/semantics/>Semantics</a> : <a href=/semantics/pronouns/>Pronouns</a> : <a href=The_strange_seemed_to have_issues_with_his/her_appearance>The_strange_seemed_to have_issues_with_his/her_appearance</a>

LSQL will create a link to the category "The_strange_seemed_to have_issues_with_his" which doesn't exist. The title needs to be passed in separately and added at the end.

Same problem also occurs in build_title_unlinked, to a lesser degree.

Code:
sub build_title_linked {
# ------------------------------------------------------------------
# Generate a linked title.
#
my $input = shift;
my $complete = 0;
my $home = 1;
if (ref $input) {
$complete = $input->{complete} || 0;
$home = defined $input->{home} ? $input->{home} : 1;
$input = $input->{name};
}
my (@dirs, $dir, $output, $path, $last, $db, $top);

$db = $DB->table('Category');
$top = Links::language('LINKS_TOP') || 'Top';

@dirs = split (/\//, $input);
$last = pop @dirs unless ($complete);
$output = $home ? qq| <a href="$CFG->{build_root_url}/$CFG->{build_index}">$top</a> :| : '';
for (0 .. $#dirs) {
$path = "/" . $db->as_url ( join "/", @dirs[0 .. $_] );
$output .= qq| <a href="$CFG->{build_root_url}$path/$CFG->{build_index}">$dirs[$_]</a> :|;
}
if ($complete) {
chop $output; chop $output;
}
else {
$output .= " $last";
}
return $output;
}
END_OF_SUB
Quote Reply
Re: [cwi] Bug? In build_title_linked In reply to
This is indeed a bug, I have had the same problem....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Bug? In build_title_linked In reply to
I think it is perhaps more of an oversight than a bug.

Where you want the slash you could try entering:

&#047;

instead.

Last edited by:

Paul: Feb 12, 2003, 2:09 AM
Quote Reply
Re: [cwi] Bug? In build_title_linked In reply to
This used to be caught. I remember getting error messages when I tried to add a "/" or "\" to the name.

I checked with a links 2.1.1 and at least in the admin, it's not being caught.

The base fix should not be trying to work around it, but either:

1) escape the sequence (and change all existing titles)

2) disallow those characters (and change all existing titles)

Trying to work around it will inevitably lead to problems in subsequent versions and existing code fixes.

I'm pretty sure in previous versions links disallowed those characters in titles. It does so in the Categories area. You can't add a Name like "His/Her items"


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.