From b0288d73ae9c94ab3d284fe37ac5fa7c5aa01d80 Mon Sep 17 00:00:00 2001 From: Pierce Date: Sun, 5 Nov 2023 21:50:03 -0500 Subject: [PATCH] add another filetype to the whitelist --- .../shared/filetypes/ftyp.lua | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lua/cfc_http_restrictions/shared/filetypes/ftyp.lua diff --git a/lua/cfc_http_restrictions/shared/filetypes/ftyp.lua b/lua/cfc_http_restrictions/shared/filetypes/ftyp.lua new file mode 100644 index 0000000..9ad81bc --- /dev/null +++ b/lua/cfc_http_restrictions/shared/filetypes/ftyp.lua @@ -0,0 +1,22 @@ +-- https://www.ftyps.com/what.html +CFCHTTP.FileTypes.FTYP = { + name = "ftyp", +} +local FTYP = CFCHTTP.FileTypes.FTYP + +---@param body string +---@return boolean +function FTYP.IsFileData( body ) + body = string.sub( body, 5 ) -- discord size bytes + if not string.StartsWith( body, "ftyp" ) then return false end + + return true +end + +---@param _ string +---@return string[] urls +---@return string|nil error +function FTYP.GetURLSFromData( _ ) + -- we want to ignore urls in FTYP containers + return {}, nil +end