Opened 8 years ago

Closed 7 years ago

#7935 closed bug (duplicate)

Text files on NTFS disk are mistakenly marked as MPEG-2 file

Reported by: Giova84 Owned by: nobody
Priority: normal Milestone: R1
Component: - General Version: R1/alpha3
Keywords: text file as video file on ntfs Cc:
Blocked By: #9193 Blocking:
Has a Patch: no Platform: x86

Description

I have a lot of text file inside a folder on a NTFS disk, most of these are mistakenly marked as MPEG-2 file (they are open with mediaplayer). to read them i have to change the file type with "FileType" add-ons.

Attachments (1)

trouble.png (12.2 KB) - added by Giova84 8 years ago.
Text file (from NTFS disk) marked as MPEG-2 video file

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by Giova84

Attachment: trouble.png added

Text file (from NTFS disk) marked as MPEG-2 video file

comment:1 Changed 8 years ago by phoudoin

I'll bet that all these texts files content starts with a 'G' character. ;-)

Last edited 8 years ago by phoudoin (previous) (diff)

comment:2 Changed 8 years ago by phoudoin

The culprit is obviously src/data/beos_mime/video/mp2t :

The sniffing rule only check that the first byte is 0x47 ('G'), but in fact a MPEG2 TS has most probably more than just one packet, so we could check that there a second TS packet at expected place instead:

resource(2, "META:SNIFF_RULE") "0.30 ([0] 0x47) ([188] 0x47)";

Could you try, using File Types preferences, to modify your video/mp2t MIME sniffing rule to that new pattern?

This will only handle TS with packet of 188 bytes, but that's the majority. Detecting both 188 and 204 packet sizes should be possible, but I'm not enough skilled in the sniffing rule syntax to have a solution to write a match for (first byte should be 0x47) AND (byte 188 OR byte 204 should be 0x47). If someone knows, feel free.

Last edited 8 years ago by phoudoin (previous) (diff)

comment:3 Changed 8 years ago by axeld

It's so weak in either case, that's it's probably a good idea to remove it completely, and only match by the file's extension.

comment:4 Changed 8 years ago by axeld

Component: File Systems/NTFS- General
Owner: changed from 3dEyes to nobody

comment:5 Changed 8 years ago by Giova84

The issue is still present in hrev43375. And yes: if a text file start with the "G" character, the text file is mistakenly marked as Mpeg-2 file.

comment:6 Changed 7 years ago by stippi

Wasn't this recently fixed by removing the MPEG2 sniffer rule?

comment:7 Changed 7 years ago by diver

Blocked By: 9193 added
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.