Project

General

Profile

Actions

Bug #2172

closed

& is replaced by &ampamp;

Added by Saurabh Garg over 19 years ago. Updated over 19 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
metacat
Target version:
Start date:
08/16/2005
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
2172

Description

Need to check for &XXX; in MetaCatUtil.normalize() function. This problem was
reported by Sven. Below are the emails describing the bug.

----------------------------------------------------
Saurabh Garg wrote:

Ah ok. I looked into the code and the patch from Johnoel only takes care
of cases which has &#xxxx;
It doesnt take care of & situation.

I did a lot of testing to check the normalize() function before Metacat
1.5 release - I am not sure why I didnt think about this case. I will
add a bug and fix it for the next release.

Sid

Duane Costa wrote:

Sid,

To see & you have to view the page source in your browser. The browser

itself will not show it.

Duane

-----Original Message-----
From: Saurabh Garg [mailto:]
Sent: Tuesday, August 16, 2005 3:57 PM
To: Matt Jones
Cc: Duane Costa; 'Sven Bohm';
Subject: Re: [metacat-dev] & and & in metacat

Hi,

Metacat 1.5 does the escaping for you even if you have
already done it.
The patch submitted by Johnoel fixes this and will be part of
the next Metacat release.

However the normalize function is called during document insertion.
Hence the document inserted already has & in it. I
think Duane's first idea might be better for the time being.

Though I didnt see & in the document which Duane sent.
Maybe I missed something or maybe it is already fixed.

Sid

Matt Jones wrote:

I think this should be fixed in Metacat's normalize()

method. Sid --

will you file a bug please? Thanks.

Matt

Duane Costa wrote:

Sven,

Yes, it looks like the ampersand in the online URL does get

escaped by

Metacat. I found a Metacat method, MetacatUtil.normalize(),

that does

this replacement, though I'm not sure at what point in the process
it's happending: during document insertion or during

document retrieval. I think the assumption Metacat is making
is that your document will not have the escaped characters in
the URL already, so it happily does the service of escaping
them for you.

There are two possible solutions I can think of (though, of

course, there are probably better ones I haven't thought of):

1. Remove the escaped ampersands from the EML and let

Metacat do the

escaping for you. However, if you need to keep the

ampersands escaped

because you are using the documents for purposes other than

just Metacat, you might need to maintain a separate
stylesheet just for Metacat harvests that does not escape the
ampersands.

2. MetacatUtil.normalize() might be modified to check for an
already-escaped ampersand before it decides to escape an

ampersand. I noticed that a patch had already been added to
check for character references:

case '&': {
/*
  • patch provided by Johnoel

Ancheta from U of Hawaii

*/
// check if & is for a character reference
&#xnnnn;

I am cc:ing metacat-dev for their thoughts.

To see an example of a document that exhibits this behavior:
http://prairie.lternet.edu:8080/knb/metacat?action=read&qfor

mat=xml&do

cid=knb-lter-kbs.1.5 Look at the <distribution><online><url> value.

Duane

-----Original Message-----
From: Sven Bohm [mailto:]
Sent: Tuesday, August 16, 2005 1:03 PM
To: duane Costa
Subject: & and & in metacat

Hi Duane

In my metacat stylesheet
http://lter.kbs.msu.edu/Data/LTER_Metadata.jsp?Dataset=KBS002x%x%
stylesheet=LTER_Metadata-eml.xsl

I set the data url to something like this:
http://lter.kbs.msu.edu/Data/taple.jsp?Product=KBS002-006&amp;

format=csv&stylesheet=data.xsl

It comes to this in the browser:
http://lter.kbs.msu.edu/Data/table.jsp?Product=KBS002-006&form
at=csv&stylesheet=data.xsl

Yet in the online distribution line on the lter metacat it gives me
this line (notice the double amp;'s:
http://lter.kbs.msu.edu/Data/table.jsp?Product=KBS002-006&amp;

amp;format=csv&amp;stylesheet=data.xsl

It looks like metacat bindly escapes &'s even if they are

part of an

escape sequence. Any thoughts?
--
Sven Bohm .- ... ---.. .-
KBS-LTER Information Manager http://www.msu.edu/~bohms/key

_______________________________________
Metacat-dev mailing list

http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinf

o/metacat-

dev

_______________________________________
Metacat-dev mailing list

http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo

/metacat-d

ev

_______________________________________
Metacat-dev mailing list

http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-dev

_______________________________________
Metacat-dev mailing list

http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/metacat-dev

Actions #1

Updated by Saurabh Garg over 19 years ago

Fixed in MetaCatUtil.normalize()

Actions #2

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 2172

Actions

Also available in: Atom PDF