Kairuni / MudletLogger

Loggers for Mudlet, for those times when you also want to log things that you don't explicitly see.
MIT License
5 stars 0 forks source link

Issue with logging HTML files and <> strings in MUD #1

Open jrmays opened 1 month ago

jrmays commented 1 month ago

As posted on the Discord by @porto on 07/25/2024:

Any strings in MUD with < > are not output into the log files.

Kairuni commented 1 month ago

Currently, the output feed for embedded HTML tags (i.e. adding tooltips) is processed at the same time as the output from the MUD.

Before content from the MUD is written into the output file, I need to sanitize the content via HTML encoding of special characters when using the HTML writer.

The culprits in this case are < and > - < and >

I'll likely do a small band-aid that just catches these two character for now, and worry about full character encoding if it becomes relevant in the future.

Kairuni commented 1 month ago

Couple points that I'll need to review:

https://github.com/Kairuni/MudletLogger/blob/main/src/scripts/Create_Logger.lua#L89-L91

Adding
to line break.

https://github.com/Kairuni/MudletLogger/blob/main/src/scripts/Logger_Handlers.lua#L46-L69

All content both read and sent to the MUD should be ingested here.

and handled by 'update' here: https://github.com/Kairuni/MudletLogger/blob/main/src/scripts/Create_Logger.lua#L121-L142

To add tooltips, you just pass in https://github.com/Kairuni/MudletLogger/blob/main/src/scripts/Logger_Utils.lua#L3-L5 with logger:log(str) - which is where we insert into the _pendingOutOfBoundsLines map of lists.

It's unclear to the user when text will actually be escaped in this situation - maybe have an argument/option to escape the HTML relevant characters on logger:log(str) with a default of true? And always escape <> when parsing content from the MUD.

I haven't tried this with MXP, might break spectacularly.