Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions apiserver/plane/api/views/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def post(self, request, slug):
project_ids=project_ids,
token_id=exporter.token,
multiple=multiple,
slug=slug,
)
return Response(
{
Expand Down
9 changes: 5 additions & 4 deletions apiserver/plane/bgtasks/export_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# Django imports
from django.conf import settings
from django.utils import timezone

# Third party imports
from celery import shared_task
Expand Down Expand Up @@ -64,15 +65,15 @@ def create_zip_file(files):
return zip_buffer


def upload_to_s3(zip_file, workspace_id, token_id):
def upload_to_s3(zip_file, workspace_id, token_id, slug):
s3 = boto3.client(
"s3",
region_name="ap-south-1",
aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
config=Config(signature_version="s3v4"),
)
file_name = f"{workspace_id}/issues-{token_id}.zip"
file_name = f"{workspace_id}/export-{slug}-{token_id[:6]}-{timezone.now()}.zip"

s3.upload_fileobj(
zip_file,
Expand Down Expand Up @@ -232,7 +233,7 @@ def generate_xlsx(header, project_id, issues, files):


@shared_task
def issue_export_task(provider, workspace_id, project_ids, token_id, multiple):
def issue_export_task(provider, workspace_id, project_ids, token_id, multiple, slug):
try:
exporter_instance = ExporterHistory.objects.get(token=token_id)
exporter_instance.status = "processing"
Expand Down Expand Up @@ -330,7 +331,7 @@ def issue_export_task(provider, workspace_id, project_ids, token_id, multiple):
)

zip_buffer = create_zip_file(files)
upload_to_s3(zip_buffer, workspace_id, token_id)
upload_to_s3(zip_buffer, workspace_id, token_id, slug)

except Exception as e:
exporter_instance = ExporterHistory.objects.get(token=token_id)
Expand Down