Skip to content

Commit

Permalink
Fix file uploads on localckan
Browse files Browse the repository at this point in the history
  • Loading branch information
Zharktas committed Mar 8, 2024
1 parent 963f927 commit 5f24e96
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ckanapi/localckan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from cgi import FieldStorage
from werkzeug.datastructures import FileStorage
from tempfile import TemporaryFile

from ckanapi.errors import CKANAPIError
Expand Down Expand Up @@ -64,10 +64,10 @@ def call_action(self, action, data_dict=None, context=None, apikey=None,
except (AttributeError, IOError):
f = _write_temp_file(f)
to_close.append(f)
field_storage = FieldStorage()
field_storage.file = f
field_storage.filename = filename
data_dict[fieldname] = field_storage
file_storage = FileStorage()
file_storage.stream = f
file_storage.filename = filename
data_dict[fieldname] = file_storage

return self._get_action(action)(context, data_dict)
finally:
Expand Down

0 comments on commit 5f24e96

Please sign in to comment.