You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Alexander (Jira)" <ji...@apache.org> on 2022/06/02 06:06:00 UTC

[jira] [Created] (TIKA-3783) Filename detection misses when a # and several . are in a filename

Alexander created TIKA-3783:
-------------------------------

             Summary: Filename detection misses when a # and several . are in a filename
                 Key: TIKA-3783
                 URL: https://issues.apache.org/jira/browse/TIKA-3783
             Project: Tika
          Issue Type: Bug
          Components: detector
         Environment: java 8
[TIKA-1928|https://issues.apache.org/jira/browse/TIKA-1928]
            Reporter: Alexander


NameDetector.detect() strip any fragments after #, but not only after extension, when filename contains dots and pound.

Example: 'ABC#192.168.0.1#2.xxx' will be stripped to 'ABC#192.168.0.1'.

There are filenames that contains dots not only in extension.

Should change line:

{code:java}
int dot = name.indexOf('.')
{code}
[https://github.com/apache/tika/blob/a52e4d153e950077f7fdedadcc5d75604fe2563d/tika-core/src/main/java/org/apache/tika/detect/NameDetector.java#L119]

to:
{code:java}
int dot = name.lastIndexOf('.');
{code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)