Opened 12 years ago

Closed 12 years ago

#1229 closed defect (fixed)

Geopublish button inactive if md title contains a crlf

Reported by: landry Owned by: geonetwork-devel@…
Priority: major Milestone: v2.8.1
Component: General Version: v2.8.0RC2
Keywords: Cc:

Description

I have a metadata which title contains a crlf, ie

Espaces Naturels Sensibles - 
Département du Cantal - 2013

This makes the Geopublish button inactive in the widgets edit view, and the console prints a message such as

Timestamp: 02/26/13 16:50:45
Error: SyntaxError: unterminated string literal
Source File: http://ids-dev.craig.fr/geocat/apps/search/index_debug.html
Line: 1, Column: 60
Source Code:
',         'a6a5a793-b9d1-4351-974a-fffd20644614',          'Espaces Naturels Sensibles -  

I suppose this is because the xsl in iso19139/present/metadata-iso19139-edit.xsl only calls escapeXMLEntities (from utils.xsl) for title

2623       <xsl:variable name="title">
2624         <xsl:apply-templates mode="escapeXMLEntities" select="/root/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString"/>
2625       </xsl:variable>

which doesnt escape/purge/removes eventual crlfs. For some reason this blows the returned xml/javascript called when hitting the geopublish button ? I'm trying to add the abstract/keyword to the things passed to GeoPublisherPanel so a way to escape/fix purge crlfs and other control codes would be appreciated.

Attachments (1)

0001-Escape-line-feeds-too-in-escapeXMLEntities-otherwise.patch (1.3 KB ) - added by landry 12 years ago.
Escape &#10; linefeed chars with n

Download all attachments as: .zip

Change History (4)

comment:1 by landry, 12 years ago

A workaround is to add the following template to xsl/utils.xsl in the escapeXMLEntities template :

                          <xsl:call-template name="replaceString">
                                  <xsl:with-param name="expr"        select="$e4"/>
                                  <xsl:with-param name="pattern"     select="'&#10;'"/>
                                  <xsl:with-param name="replacement" select="'\\n'"/>
                          </xsl:call-template>

With that, the title string is properly passed to the GeoPublishPanel.

That's quite a hack - but anyway, the title needs to be sanitized from control chars.

by landry, 12 years ago

Escape &#10; linefeed chars with
n

comment:2 by ianwallen, 12 years ago

Milestone: v2.9.0v2.8.1

Commit in master 0df3a20946e75ff3122a870c8f82d680884cf4fe

Ticket #1232 depends on this request - it still needs to be cherry picked to the 2.8 branch before closing the ticket.

comment:3 by ianwallen, 12 years ago

Resolution: fixed
Status: newclosed

Commit in 2.8 branch 64b8042bbbcc0c1a97b293b7b55e85bcea7c7fb5

Note: See TracTickets for help on using tickets.