GitLab project import crashes when the .tar.gz file is invalid instead of saying that the file is invalid
I hesitated between bug and feature proposal... Went with bug because of the error message.
Summary
Project import accepts any .tar.gz file and crashes with an unhelpful error message. The crash is normal, I want to address the error message with this issue.
Context
I was testing an issue that required me to modify my GitLab project file export and I did a mistake while repackaging (I included the directory in the archive instead of only the files). The error wasn't very descriptive and I lost a fair bit of time trying to understand the bug. I understand that modifying an archive is certainly not a common usage scenario and if you feel like no normal user will ever do that feel free to dismiss this bug.
Steps to reproduce
- Create a dummy
.tar.gzfileecho 'this is a test' > testfile && tar czvf testfile.tar.gz testfile - New Project page
- Import Project button
- Gitlab Export button
- Pick a group and import the file from step 1
What is the current bug behavior?
This is displayed in https://gitlab.com/:group/:project/-/import/new

What is the expected correct behavior?
A message saying the archive is invalid similar to the message we get when trying to import a file that isn't a .tar.gz file.
Output of checks
This bug happens on GitLab.com
Possible fixes
Make sure all the archive files (GITLAB_REVISION, GITLAB_VERSION, VERSION, lfs-objects.json, project.bundle, project.json) are present in the uploaded file before processing.