MobiFlight / HubHop-Website

2 stars 1 forks source link

G3X Touch events mislabeled #54

Open davidlav opened 2 years ago

davidlav commented 2 years ago

Describe the bug There are 12 events that support the stock G3X Touch display (used in the X Cub and VL-3). 11 of them are erroneously prefixed with an underscore.

Steps To Reproduce See lines 1666 - 1676 of events.txt (below). You'll see they begin with an underscore character.

https://github.com/MobiFlight/MobiFlight-Connector/blob/dc5772bdf38e63c91d8d30512109913e37f6ce1e/MSFS2020-module/mobiflight-event-module/modules/events.txt#L1666-L1676

Expected behavior They should instead look like the one correctly-name event, orphaned by itself on line 1865 (below).

https://github.com/MobiFlight/MobiFlight-Connector/blob/dc5772bdf38e63c91d8d30512109913e37f6ce1e/MSFS2020-module/mobiflight-event-module/modules/events.txt#L1865

Additional context Hubhop has them named correctly, without prefixed underscores:

image

JaimeLeon2 commented 2 years ago

The issue is that the event name was prefixed by a space when created and Hubhop converts spaces in the names to underscores. Solution is to delete the space in front. I have fixed the preceding space in Hubhop. Hubhop should now generate the correct name for events.txt.

davidlav commented 2 years ago

Ah, okay. Thanks.

Can I suggest that you add calling trim() on input values to avoid this in the future?

I was the one who added those values to Hubhob originally and never realized I was pasting unnecessary white space in there in the first place.

Appreciate the fix though!

MobiFlight-Admin commented 2 years ago

Adding trim does make sense, on creating and as well as on exporting. Just in case

MobiFlight-Admin commented 2 years ago

I moved the issue to the Hubhop Repository

rofl-er commented 2 years ago

Thanks. Can you check what you can do in the exporter, @MobiFlight-Admin ?

JaimeLeon2 commented 2 years ago

I think the correct solution is to not allow the event names to start or end with spaces or any special characters, only alpha numeric, when the events are created, rather than patching it on export.

MobiFlight-Admin commented 2 years ago

I agree, sanitizing input should be done on saving... but even there it could be on API level or the front end or both.

API is probably the better spot because we can submit stuff without UI too