rapps-db
rapps-db copied to clipboard
[CI] Validate uploaded icons
.ico files just start with 3 zero bytes or something like that, would be trivial to do without external tools if all one cares about is not being confused with a PNG or jpg.
I say this as someone who runs the validation inside ROS and is sensitive in python changes.
.ico files just start with 3 zero bytes or something like that, would be trivial to do without external tools if all one cares about is not being confused with a PNG or jpg.
I say this as someone who runs the validation inside ROS and is sensitive in python changes.
Does this updated script no longer work for you?
Does this updated script no longer work for you?
No, not directly no.
python -m pip install --upgrade pip
python -m pip install python-magic
python -m pip install python-magic-bin
.github\validate-rapps.py
and it then fails with a missing VC runtime error (caused by python-magic-bin).
All you need is
# Check 6 byte icon header
import struct
f = open("winfile.ico", "rb")
if struct.unpack("<H", f.read(2))[0] == 0:
if struct.unpack("<H", f.read(2))[0] == 1:
if struct.unpack("<H", f.read(2))[0] > 0:
print("Smells like a .ico")
f.close()
(Pardon my bad style, I hate Python)
ROS is limited to Python v3.4.4