Sometimes files can get into the file table with unacceptable file extension, so the following regex might extract something with non-alphanumeric characters.
|
( $file_extension ) = $main =~ /(([^.\s]+)+)$/; |
Therefore, if this regex was modified to also say match non-word characters (\W) then unacceptable file extensions won't be found. As the file extension is and only used in a regex to determine the temporary name for a file to write out the words to be indexed, then an extra line to use "dat" if an extension cannot be determine, should be an acceptable alternative.
( $file_extension ) = $main =~ /(([^.\s\W]+)+)$/; # \W ensures there are no unusual characters in the file extension
$file_extension ||= 'dat'; # If there is no file extension (possibly because it has been excluded for unusual characters) just use 'dat'
Sometimes files can get into the file table with unacceptable file extension, so the following regex might extract something with non-alphanumeric characters.
eprints3.4/perl_lib/EPrints/Plugin/Convert/PlainText.pm
Line 105 in 792cc18
Therefore, if this regex was modified to also say match non-word characters (
\W) then unacceptable file extensions won't be found. As the file extension is and only used in a regex to determine the temporary name for a file to write out the words to be indexed, then an extra line to use "dat" if an extension cannot be determine, should be an acceptable alternative.