Fixed WebP image detection to prevent misidentification of WAV audio files by checking both the RIFF and WEBP markers in the file header. WAV and WebP use the same container (denoted by RIFF), but have different file formats (denoted by the later bytes WEBP and WAV). Added unit tests to verify correctness.
Fixed WebP image detection to prevent misidentification of WAV audio files by checking both the
RIFF
andWEBP
markers in the file header. WAV and WebP use the same container (denoted byRIFF
), but have different file formats (denoted by the later bytesWEBP
andWAV
). Added unit tests to verify correctness.WebP Container Specification
WAV file header bytes
WebP file header bytes