Commit d6a40f40 authored by tlc@void's avatar tlc@void
Browse files

Fix conflict

parent 1ff5a98f
Pipeline #123304 passed with stages
in 41 minutes and 20 seconds
......@@ -1042,20 +1042,23 @@ async def get_entry_raw_file(
return StreamingResponse(raw_file_content, media_type=mime_type)
async def answer_entry_archive_request(query: Dict[str, Any], required: ArchiveRequired, user: User):
async def answer_entry_archive_request(
query: Dict[str, Any], required: ArchiveRequired, user: User, entry_metadata=None):
required_reader = _validate_required(required)
response = perform_search(
owner=Owner.visible, query=query,
required=MetadataRequired(include=['entry_id', 'upload_id', 'parser_name']),
user_id=user.user_id if user is not None else None)
if not entry_metadata:
response = perform_search(
owner=Owner.visible, query=query,
required=MetadataRequired(include=['entry_id', 'upload_id', 'parser_name']),
user_id=user.user_id if user is not None else None)
if response.pagination.total == 0:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail='The entry does not exist or is not visible to you.')
if response.pagination.total == 0:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail='The entry does not exist or is not visible to you.')
entry_metadata = response.data[0]
entry_metadata = response.data[0]
entry_id = entry_metadata['entry_id']
uploads = _Uploads()
......
......@@ -934,16 +934,16 @@ async def put_upload_raw_path(
archive = None
if entry and entry.process_status == ProcessStatus.SUCCESS and include_archive:
# NOTE: We can't rely on ES to get the metadata for the entry, since it may
# not have hade enough time to update its index etc. For now, we will just
# not have had enough time to update its index etc. For now, we will just
# ignore this, as we do not need it.
entry_metadata = dict(
upload_id=upload_id,
entry_id=entry.entry_id,
parser_name=entry.parser_name)
archive = answer_entry_archive_request(
archive = (await answer_entry_archive_request(
dict(upload_id=upload_id, mainfile=full_path),
required='*', user=user,
entry_metadata=entry_metadata)['data']['archive']
entry_metadata=entry_metadata))['data']['archive']
response = PutRawFileResponse(
upload_id=upload_id,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment