Skip to content

Commit

Permalink
Upload unique file name
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Jul 19, 2024
1 parent 9b97e8f commit 4481a32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ckanext/bulkupload/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path
import boto3
from botocore.exceptions import ClientError
import ckan.lib.munge as munge
import uuid

from ckan.common import g
from ckan.logic.action import get
Expand Down Expand Up @@ -178,7 +178,8 @@ def bulk_resource_upload(pkg_name):
}

x = tk.get_action("resource_create")(context, data_dict)
file_name = os.path.join(storage_path, f.filename)
unique_filename = str(uuid.uuid4())[:8] + str(f.filename)
file_name = os.path.join(storage_path, unique_filename)
f.save(file_name)

object_name = '/resources/' + x['id'] + '/' + f.filename
Expand Down

0 comments on commit 4481a32

Please sign in to comment.