Ticket #557 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

no dmsafe in perl code please

Reported by: kjdon Owned by: kjdon
Priority: moderate Milestone: 2.84 Release
Component: Collection Building Severity: major
Keywords: Cc:

Description

Request from Michael

He is using Source metadata and it has been dmsafed (ie underscores escaped). Which means that it is invalid.

This assumes that the receptionist code is going to be serving the collection, which is not necessarily so. eg oaiserver, gs3.

dmsafeing should be done in the receptionist. Michael suggests a [dmsafe:xxx] thing for metadata.

The problem that I see is that we have macros in metadata, and the receptionist needs to be able to distinguish between macros and plain underscores. eg in srclink. a. any reason why srclink is generated at buildtime and not runtime? b. could do it as _httpcollection_/.../[dmsafe:Source] c. If we can get rid of most of macros from metadata then things will work better in gs3. d. what other macros are used in metadata? e. this applies to text as well. how to get around that?

Change History

Changed 9 years ago by kjdon

  • milestone changed from Greenstone 2 wishlist to 2.84 Release

Changed 9 years ago by kjdon

Has this gone away now that we have Source and SourceFile???

Changed 9 years ago by mdewsnip

  • status changed from new to closed
  • resolution set to fixed

- Removed call to ghtml::dmsafe() from BasePlugin::filename_to_utf8_metadata(). This shouldn't be done in the build time code because it is a runtime issue -- if you aren't using the Greenstone 2 receptionist (e.g OAI server, Greenstone 3) then escaping underscores just creates problems.

- Removed dmsafe() function from ghtml.pm, to prevent people from being tempted to use it in the future.

- Added new "dmsafe:" format statement modifier.

- Changed vlistbrowserclass.cpp and demo/etc/collect.cfg to use the new "dmsafe:" format statement modifier on Source metadata, now that underscores will no longer be escaped at build time.

- Removed some old (commented out) "[srclink]" code from a bunch of plugins. Katherine removed [srclink] in March -- it is now dynamically generated.

- Changed MediainfoOGVPlugin.pm to add "srclink_file" metadata instead of the deprecated "srclink" and "/srclink" values.

- Changed "srcicon" values in ImageConverter?.pm and ImagePlugin?.pm to use "[srclink_file]", for consistency.

- Changed "srclink_file" metadata to always contain the filename, instead of referencing another metadata element, in a bunch of plugins. This is so the C++ code can escape underscores in the filename values correctly.

- Added code to formattools.cpp to always apply dm_safe() to [srclink_file] metadata values, because these should be filenames only (that shouldn't contain macros), and we need to escape underscores in the filenames to avoid confusing the macro system.

- Added code to set optionsassocfilepath? so [srclink] works in DocumentText? format statements.

Note: See TracTickets for help on using tickets.