Skip to content

Commit

Permalink
fix: zip structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie committed May 23, 2024
1 parent 6f47fe0 commit 891ddbc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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}

0 comments on commit 891ddbc

Please sign in to comment.