Commit e66e8127 authored by Nicolas Delaby's avatar Nicolas Delaby

* Use a clever fix and let Document.discoverMetaData doing his job;

but ContributionTool is not supposed to overlaod user argument.
This is the fix: do not override file_name provided by user.
Reviewed by Jerome


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32054 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 85991ce1
......@@ -128,7 +128,6 @@ class ContributionTool(BaseTool):
We always generate ID. So, we must prevent using the one
which we were provided.
"""
user_filename = file_name # store original filename
if file_name is not None:
kw['file_name'] = file_name
if data is not None:
......@@ -144,12 +143,11 @@ class ContributionTool(BaseTool):
document = None
# Try to find the file_name
file_name = None
mime_type = None
if not url:
# check if file was provided
file = kw.get('file', None)
if file is not None:
if file is not None and file_name is None:
file_name = file.filename
else:
# some channels supply data and file-name separately
......@@ -248,9 +246,6 @@ class ContributionTool(BaseTool):
if getattr(document, 'guessMimeType', None) is not None:
# For File force to setup the mime_type
document.guessMimeType(fname=file_name)
if user_filename:
# Restore the Original filename pass by the user
document.setSourceReference(user_filename)
if url:
document.fromURL(url)
......
Markdown is supported
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