Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation should actually say what's wrong #312

Closed
lnicola opened this issue Nov 26, 2023 · 1 comment
Closed

Validation should actually say what's wrong #312

lnicola opened this issue Nov 26, 2023 · 1 comment
Assignees
Labels
🕔 Size 3 It will take me between 2 hours to half a day

Comments

@lnicola
Copy link

lnicola commented Nov 26, 2023

I'm not involved in QGIS, but I've recently seen two users complaining on mantra-request about not being able to upload their archives because of the __pycache__ check. They were sure they didn't have any cache folders, but still got this error from the site.

Alas, they were both wrong, but the validator already know the path to the forbidden file(s) in the archive. It should include that in the error message instead of showing such an unhelpful error.

This can be implemented by including zname in the error message at

if zname.find(".pyc") != -1:
raise ValidationError(
_("For security reasons, zip file cannot contain .pyc file")
)
for forbidden_dir in ["__MACOSX", ".git", "__pycache__"]:
if forbidden_dir in zname.split("/"):
raise ValidationError(
_(
"For security reasons, zip file "
"cannot contain '%s' directory" % (forbidden_dir,)
)
)
, but it will require updating the tests.

@Xpirix Xpirix self-assigned this Apr 17, 2024
@Xpirix Xpirix added the 🕔 Size 3 It will take me between 2 hours to half a day label Apr 19, 2024
@Xpirix
Copy link
Collaborator

Xpirix commented Apr 22, 2024

Please find the proposed fix for this at #387

@Xpirix Xpirix closed this as completed May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕔 Size 3 It will take me between 2 hours to half a day
Projects
Development

No branches or pull requests

2 participants