[vlc-devel] [PATCH] Disable lua-precessig in locally stored js-files. Many js-scripts (e.g. JQuery) contains regular expressions that incorrect processed in the process_raw function. This commit disable lua-processing for .js files.

Александр Ковернинский a.koverninsky at gmail.com
Fri Jul 12 14:42:26 CEST 2019


Hi Rémi.
You are right. I can't assume that file type always matches the file
extension.
But on the line 177-179 the same :)

        *local ext = string.match(filename,"%.([^%.]-)$")*
        local raw = io.open(filename, 'rb'):read("*a")
        *local content = [[Content-Type: ]]..mimes[ext]..[[*

Best regards,
Alexandr


пт, 12 июл. 2019 г. в 15:31, Rémi Denis-Courmont <remi at remlab.net>:

> Hi,
>
> I don't follow the logic here. You can't assume that file type always
> matches the file extension.
>
> Le 12 juillet 2019 14:06:51 GMT+03:00, Alexandr Koverninsky <
> a.koverninsky at gmail.com> a écrit :
>>
>> ------------------------------
>>  share/lua/intf/http.lua | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
>> index fc6d1a3156..d40f423bee 100644
>> --- a/share/lua/intf/http.lua
>> +++ b/share/lua/intf/http.lua
>> @@ -78,6 +78,10 @@ function process_raw(filename)
>>      --]]
>>      local code0 = string.gsub(input,escape(close_tag)," print(["..str.."[")
>>      local code1 = string.gsub(code0,escape(open_tag),"]"..str.."]) ")
>> +    local fileext=filename:match("^.+(%..+)$")
>> +    if fileext == ".js" then
>> +      code1=input;
>> +    end
>>      local code = "print(["..str.."["..code1.."]"..str.."])"
>>      --[[ Uncomment to debug
>>      if string.match(filename,"vlm_cmd.xml$") then
>>
>>
> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma
> brièveté.
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190712/a0106b99/attachment.html>


More information about the vlc-devel mailing list