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

fix: zip structure #472

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/api/fixtures/realistic/realistic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@
- model: api.structurecheck
pk: 1
fields:
path: "verslag/"
path: "verslag"
project: 0
obligated_extensions:
- 3
blocked_extensions: []
- model: api.structurecheck
pk: 2
fields:
path: src/
path: src
project: 1
obligated_extensions:
- 1
Expand All @@ -156,7 +156,7 @@
- model: api.structurecheck
pk: 3
fields:
path: verslag/
path: verslag
project: 1
obligated_extensions:
- 3
Expand Down
2 changes: 1 addition & 1 deletion backend/api/logic/parse_zip_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def parse_zip(project: Project, zip_file: InMemoryUploadedFile) -> bool:
if common_prefix[-1] != '/':
prefixes = prefixes[:-1]

directories += [prefix + '/' for prefix in prefixes]
directories += [prefix for prefix in prefixes]

# Add for each directory a structure check
for directory in directories:
Expand Down
2 changes: 1 addition & 1 deletion backend/api/tasks/structure_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ def _get_all_name_ext(path: str) -> dict[str, str]:
with zipfile.ZipFile(zip_data, 'r') as inner_zip:
file_list = inner_zip.namelist()

return {file: file.split('.')[-1] for file in file_list}
return {'/'.join(file.split('/')[:-1]): file.split('.')[-1] for file in file_list}
Loading