• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage.php
  • Класс: CCloudStorage
  • Вызов: CCloudStorage::FixFileContentType
static function FixFileContentType(&$arFile)
{
	global $DB;
	$fixedContentType = "";

	if ($arFile["CONTENT_TYPE"] === "image/jpg")
		$fixedContentType = "image/jpeg";
	else
	{
		$hexContentType = unpack("H*", $arFile["CONTENT_TYPE"]);
		if (
			$hexContentType[1] === "e0f3e4e8ee2f6d706567"
			|| $hexContentType[1] === "d0b0d183d0b4d0b8d0be2f6d706567"
		)
			$fixedContentType = "audio/mpeg";
	}

	if ($fixedContentType !== "")
	{
		$arFile["CONTENT_TYPE"] = $fixedContentType;
		$DB->Query("
			UPDATE b_file
			SET CONTENT_TYPE = '".$DB->ForSQL($fixedContentType)."'
			WHERE ID = ".intval($arFile["ID"])."
		");
		CFile::CleanCache($arFile["ID"]);
	}
}