Commit Graph

64 Commits

Author SHA1 Message Date
Maciej
933a717f3b LibCore: Make application/octet-stream the default guessed MIME type
This MIME type can be associated with every file, text/plain only with
plaintext files.

This makes browsers (e.g Firefox) properly displaying download progress
when downloading files in WebServer :^)
2022-03-19 22:03:51 +01:00
kimlintu
89c846a31c LibCore: Add support for application/zip mime-type
The local file header signature of a ZIP entry is normally 0x04034B50
and stored in little-endian byte order. Therefore, if the archive
starts with an entry we can identify a ZIP file by checking if the
first two bytes are 0x504B (PK).

Also checks for the .zip file extension, which is is also used by file
if no byte signature was detected.
2022-03-08 22:38:53 +01:00
Linus Groh
ae0d6ba72c LibCore: Add support for the image/x-qoi mime type
We can guess it both from the magic bytes 'qoif' or the file extension
'.qoi'. The mime type is made up, I don't think it has an official one
yet - using the 'x-' prefix should be fine though.
2021-12-21 13:27:27 +01:00
Andreas Kling
80d4e830a0 Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Valtteri Koskivuori
cb8d0c8d0d LibCore+Userland: Add 13 more detectable file types
This patch adds 13 new detectable file formats, which are as follows in
alphabetical order:
.blend, .isz, ext* filesystem, Lua bytecode, Matroska container, NES
ROM, .pdf, qcow image, .rtf, WebAssembly bytecode, Windows 3.1X/95
compressed archive and raw zlib stream

Some are a tad esoteric, but the more file types we detect, the more
useful this utility becomes! :^)
2021-05-24 18:55:56 +01:00
Valtteri Koskivuori
eb9a0ace28 LibCore+Userland: Add two more detectable formats
Second batch of detectable formats, this time with verious offsets, as
enabled by the previous commit.
This adds tar, and the three signature variants for iso-9660 image
files.
2021-05-18 19:57:53 +01:00
Valtteri Koskivuori
241b378e4b LibCore: Add offsets to binary signature matching
Some file signatures are at an offset into the file, so we need to be
able to specify an offset to start matching bytes at.
2021-05-18 19:57:53 +01:00
Valtteri Koskivuori
105bbc457d LibCore+Userland: Add 5 more detectable filetypes
This adds gzip, sqlite, 7-Zip, flac and midi.
2021-05-18 19:57:53 +01:00
Gunnar Beutner
f0fa51773a AK+Userland: Fix some compiler warnings and make variables const-ref
This fixes a few compiler warnings and makes some variables const-ref
in preparation for the next commit which changes how ByteBuffer works.
2021-05-16 17:49:42 +02:00
Valtteri Koskivuori
00de3b53c8 LibCore+Userland: Add more detectable types
More binary format detectors and descriptions
2021-05-07 11:46:53 +01:00
Valtteri Koskivuori
cf5f3a9874 LibCore: Implement basic mime type guessing based on binary patterns
This attempts to guess the mime-type from a given set of bytes from the
start of a file. It only supports a few well-defined patterns for now,
but it's a start!
2021-05-07 11:46:53 +01:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00