filetype icon indicating copy to clipboard operation
filetype copied to clipboard

tar file not being recognized

Open marcosnils opened this issue 2 years ago • 1 comments

:wave: filetype happy user here! Today someone opened an issue in my bin project (https://github.com/marcosnils/bin/issues/140) which led me here.

Filetype is not being able to detect the tar archive inside this gzipped file here https://github.com/sass/dart-sass/releases/download/1.52.3/dart-sass-1.52.3-linux-x64.tar.gz. However, tar -xf works and running file <dart-sass-1.52.3-linux-x64.tar> correctly detects the filetype.

Clearly seems like the file MIME headers are not being properly set. Still.. it's interesting how file still detects it as a tar archive even if the extension is removed.

file -i pepe 
pepe: application/x-tar; charset=binary

Any pointers here?

marcosnils avatar Jun 21 '22 17:06 marcosnils

I see it's coming from here: https://sources.debian.org/src/file/1%3A5.39-3/src/funcs.c/#L296

Seems like file still tries to parse the file regardless if the MIME headers are found or not... I think I'll change bin to do a similar approach instead of just relying on MIME headers.

marcosnils avatar Jun 21 '22 19:06 marcosnils