CF Link values

Hi

I am using RT3.8.8

I have a CF where the “Link value to” contains

http://cvsweb/__CustomField__

RT generates a link but if I click on the link I get a 404 error using
Firefox.
I am pretty sure that I saw this work when I first set it up with RT 3.6

If I look at the generated source of the page, I see

aaaa/bbbb/cccc/dddd

The code is in share/html/Elements/ShowCustomFields

my $linked = $value->LinkValueTo;
 if ( defined $linked&&  length $linked ) {
     my $linked = $m->interp->apply_escapes( $linked, 'h' );
     $m->out('<a href="'. $linked .'" target="_new">');
 }

The code for RT3.6.10 shows
my $linked = $cf->LinkValueTo;
if ( $linked ) {
$m->out(‘’);
}

How can I tell Mason not to escape ‘/’ and still escape the rest ?

In fact, I am uncertain why ‘/’ gets escaped
because my understanding of Mason is that ‘h’ refers to basic_html_escape
which is supposed to escape only ‘&’,‘>’,‘<’, and ‘"’.

Thanks
Gerard

Hi

I am using RT3.8.8

I have a CF where the “Link value to” contains

http://cvsweb/__CustomField__

RT generates a link but if I click on the link I get a 404 error using
Firefox.
I am pretty sure that I saw this work when I first set it up with RT 3.6

If I look at the generated source of the page, I see

aaaa/bbbb/cccc/dddd

The code is in share/html/Elements/ShowCustomFields

my $linked = $value->LinkValueTo;
if ( defined $linked && length $linked ) {
my $linked = $m->interp->apply_escapes( $linked, ‘h’ );
$m->out(‘’);
}

The code for RT3.6.10 shows
my $linked = $cf->LinkValueTo;
if ( $linked ) {
$m->out(‘
’);
}

How can I tell Mason not to escape ‘/’ and still escape the rest ?

Escaping you have problem with is not happening here. Take a look into
lib/RT/ObjectCustomFieldValue.pm, method _FillInTemplateURL.

In fact, I am uncertain why ‘/’ gets escaped
because my understanding of Mason is that ‘h’ refers to basic_html_escape
which is supposed to escape only ‘&’, ‘>’, ‘<’, and ‘"’.

Thanks
Gerard


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston — March 5 & 6, 2012

Best regards, Ruslan.

Hi

I am using RT3.8.8

I have a CF where the “Link value to” contains

http://cvsweb/__CustomField__

RT generates a link but if I click on the link I get a 404 error using
Firefox.
I am pretty sure that I saw this work when I first set it up with RT 3.6

If I look at the generated source of the page, I see

aaaa/bbbb/cccc/dddd

The code is in share/html/Elements/ShowCustomFields

my $linked = $value->LinkValueTo;
 if ( defined $linked&&  length $linked ) {
     my $linked = $m->interp->apply_escapes( $linked, 'h' );
     $m->out('<a href="'. $linked .'" target="_new">');
 }

The code for RT3.6.10 shows
my $linked = $cf->LinkValueTo;
if ( $linked ) {
$m->out(‘’);
}

How can I tell Mason not to escape ‘/’ and still escape the rest ?

Escaping you have problem with is not happening here. Take a look into
lib/RT/ObjectCustomFieldValue.pm, method _FillInTemplateURL.

Thanks Ruslan

is it safe to change
CustomField => { value => sub { $[0]->Content }, escape => 1 },
to
CustomField => { value => sub { $
[0]->Content } },
in _FillInTemplateURL ?

Or should I change
$$ref =~ s/([^a-zA-Z0-9_.!~'()-])/uc sprintf(“%%%02X”, ord($1))/eg;
to
$$ref =~ s/([^a-zA-Z0-9_.!~
'()/-])/uc sprintf(“%%%02X”, ord($1))/eg;
in RT::Interface::Web::EscapeURI ?

Gerard

is it safe to change
CustomField => { value => sub { $[0]->Content }, escape => 1 },
to
CustomField => { value => sub { $
[0]->Content } },
in _FillInTemplateURL ?

Only if you know what you’re doing.

Or should I change
$ref =~ s/([^a-zA-Z0-9_.!~'()-])/uc sprintf(“%%%02X”, ord($1))/eg;
to
$ref =~ s/([^a-zA-Z0-9_.!~
'()/-])/uc sprintf(“%%%02X”, ord($1))/eg;
in RT::Interface::Web::EscapeURI ?

No, you shouldn’t.

Best regards, Ruslan.

This was sent to Ruslan only by mistake.
Resending to the list for others to see.
GerardOn 2011-12-08 16:30, Gerard FENELON wrote:

Thanks Ruslan
finally I used “AllowEncodedSlashes On” on the destiantion server
Gerard

On 2011-12-08 15:48, Ruslan Zakirov wrote:

On Thu, Dec 8, 2011 at 18:12, Gerard FENELONgerard@eve-team.com wrote:

is it safe to change
CustomField => { value => sub { $[0]->Content }, escape => 1 },
to
CustomField => { value => sub { $
[0]->Content } },
in _FillInTemplateURL ?
Only if you know what you’re doing.

Or should I change
$ref =~ s/([^a-zA-Z0-9_.!~'()-])/uc sprintf(“%%%02X”, ord($1))/eg;
to
$ref =~ s/([^a-zA-Z0-9_.!~
'()/-])/uc sprintf(“%%%02X”,
ord($1))/eg;
in RT::Interface::Web::EscapeURI ?
No, you shouldn’t.