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

hotfix: check urn before importing dependencies #1300

Merged
merged 2 commits into from
Jan 3, 2025
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
16 changes: 10 additions & 6 deletions backend/library/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,16 @@ def check_and_import_dependencies(self):
return None
for dependency_urn in self._library.dependencies:
if not LoadedLibrary.objects.filter(urn=dependency_urn).exists():
dependency = StoredLibrary.objects.get(
urn=dependency_urn
) # We only fetch by URN without thinking about what locale, that may be a problem in the future.
error_msg = dependency.load()
if error_msg is not None:
return error_msg
try:
dependency = StoredLibrary.objects.get(urn=dependency_urn)
# We only fetch by URN without thinking about what locale, that may be a problem in the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant with out current way of handling library internationalization?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we can remove this old comment

error_msg = dependency.load()
if error_msg is not None:
return error_msg
except StoredLibrary.DoesNotExist:
err_msg = f"ERROR: Stored Library with URN {dependency_urn} does not exist"
print(err_msg)
raise Http404(err_msg)
else:
# try to update the dependency, because we might need the last version for the main library
dependency = LoadedLibrary.objects.get(urn=dependency_urn)
Expand Down
Binary file modified tools/NIS2/nis2-directive.xlsx
Binary file not shown.
Loading