[EP-tech] Patch suggestion: Form value of MetaField::Name fields having surrounding spaces stripped off

Florian Heß hess at ub.uni-heidelberg.de
Thu Oct 17 12:46:37 BST 2013


Hi E-Prints developers,

if the user happens to leave trailing spaces in the name field, the 
browse view would display the name once more and ignore that the name 
already exists without trailing space. That's why the creator's browse 
view accumulates doubles and maybe triples of names over time. So how 
about stripping off accidentally input spaces so the repos browse views 
- those generated of fields with freely entered values - are kept clean?

Please tell me if the patch will be applied officially in the next 
version of EPrints, or if I am rather to use the fromform()-callback. In 
my opinion, this issue isn't specific to our repository, hence ...

# in package MetaField::Name ...
# inspired from sub &MetaField::Multipart::form_value_basic
sub form_value_basic
{
         my( $self, $session, $basename ) = @_;

         my $value = 
$self->EPrints::MetaField::Compound::form_value_basic( $session, 
$basename );

         s{^\s+}{}, s{\s+$}{} for values %$value;

         return $value;
}

The patch has been roughly tested.

Kind regards,
Florian

-- 
UB Heidelberg (Altstadt)
Plöck 107-109, 69117 HD
Abt. Informationstechnik
Tel. 06221 / 54 3550
http://www.ub.uni-heidelberg.de/



More information about the Eprints-tech mailing list