python-discord / snekbox

Easy, safe evaluation of arbitrary Python code
https://pythondiscord.com
MIT License
214 stars 39 forks source link

`HOME` env var missing root slash. #212

Closed vivax3794 closed 5 months ago

vivax3794 commented 5 months ago

currently HOME is set as home which is a relative path, which means for example when you use pathlib.Path.home() it gives you a relative path, which wont work correctly. The path should be absolute, i.e /home

(I am not too familiar with the codebase, but this seems to be the line it is set) https://github.com/python-discord/snekbox/blob/d38694817cb5ee8481eb41a27b807fe97911d74c/config/snekbox.cfg#L21

this isnt really that big of a issue, but thought it worth to point out, as for example if you want to list out the files in the home directory:

from pathlib import Path

print(list(Path("/home").glob("*")))
print(list(Path.home().glob("*")))

it wont work with .home() image