Skip to content

Handle indexing of files with unusual file extensions #601

Description

@drn05r

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'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions