Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@@personal-information breaks after portrait was uploaded in Plone 5.1.5 #2709

Closed
pgrunewald opened this issue Jan 31, 2019 · 4 comments
Closed

Comments

@pgrunewald
Copy link

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

  1. Go to: http://localhost:8080/Plone/@@personal-information
  2. Choose an image for the portrait field and save
  3. Go To @@personal-information again and click save.

What I expect to happen:

Forms should submit successfully.

What actually happened:

Form breaks with this stacktrace:

Traceback (innermost last):

Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
Module ZPublisher.Publish, line 48, in call_object
Module plone.app.users.browser.userdatapanel, line 94, in __call__
Module z3c.form.form, line 233, in __call__
Module plone.z3cform.fieldsets.extensible, line 65, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 132, in update
Module z3c.form.form, line 136, in updateWidgets
Module z3c.form.field, line 277, in update
Module z3c.form.browser.text, line 36, in update
Module z3c.form.browser.widget, line 171, in update
Module Products.CMFPlone.patches.z3c_form, line 47, in _wrapped
Module z3c.form.widget, line 88, in update
Module plone.formwidget.namedfile.widget, line 276, in extract
Module plone.namedfile.utils, line 42, in safe_basename
AttributeError: 'NoneType' object has no attribute 'rfind'

When choosing the different or same image to upload, the form works just fine. But if portrait is left changed, the error comes again.

What version of Plone/ Addons I am using:

Vanilla Plone 5.1.5

Note: It works however in Plone 5.1.2!

@pbauer
Copy link
Member

pbauer commented Feb 5, 2019

The problem was introduced in plone/plone.formwidget.namedfile#32 where the case that the filename is None is not handled.

@pbauer
Copy link
Member

pbauer commented Feb 5, 2019

Also currently it seems that the upload_map (IFileUploadTemporaryStorage) always keeps a reference to the previously stored value. Even after restarting the instance and even after del upload_map[file_upload_id] has run. So the code always attempts to create the file anew.
Confirmed in Plone 5.2 master with Python 2.7
@thet: can you please comment on that, since you added the mentioned changes.

@pbauer
Copy link
Member

pbauer commented Mar 11, 2019

@thet ping

mauritsvanrees added a commit to plone/plone.formwidget.namedfile that referenced this issue Mar 22, 2019
…t is a POST request.

Fixes auto csrf error in site-controlpanel (plone/Products.CMFPlone#2628)
and personal-information (plone/Products.CMFPlone#2709) page.
mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Mar 26, 2019
Branch: refs/heads/master
Date: 2019-03-22T22:51:01+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@efdf292

Only use the new feature for keeping an already uploaded image when it is a POST request.

Fixes auto csrf error in site-controlpanel (plone/Products.CMFPlone#2628)
and personal-information (plone/Products.CMFPlone#2709) page.

Files changed:
A news/2628.bugfix
M plone/formwidget/namedfile/widget.py
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-25T14:10:32+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@b77b76e

Add more test isolation to widgets.rst.

With a new request, we should instantiate a new widget and call update and extract on it.
Otherwise for example a file_upload_id can linger from a previous call.

Files changed:
M plone/formwidget/namedfile/widget.rst
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-25T14:46:37+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@3975588

Fixed Py23DocChecker.

There was a small mistake on Python 2: we basically set 'got = want', which meant the doctests always passed...

Files changed:
M plone/formwidget/namedfile/tests.py
M plone/formwidget/namedfile/widget.rst
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-26T12:43:01+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.formwidget.namedfile@846f5f4

Merge pull request #38 from plone/maurits-issue-2813-plone-protect

Only keep already uploaded image when it is a POST request

Files changed:
A news/2628.bugfix
M plone/formwidget/namedfile/tests.py
M plone/formwidget/namedfile/widget.py
M plone/formwidget/namedfile/widget.rst
mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Mar 26, 2019
Branch: refs/heads/master
Date: 2019-03-22T22:51:01+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@efdf292

Only use the new feature for keeping an already uploaded image when it is a POST request.

Fixes auto csrf error in site-controlpanel (plone/Products.CMFPlone#2628)
and personal-information (plone/Products.CMFPlone#2709) page.

Files changed:
A news/2628.bugfix
M plone/formwidget/namedfile/widget.py
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-25T14:10:32+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@b77b76e

Add more test isolation to widgets.rst.

With a new request, we should instantiate a new widget and call update and extract on it.
Otherwise for example a file_upload_id can linger from a previous call.

Files changed:
M plone/formwidget/namedfile/widget.rst
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-25T14:46:37+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.formwidget.namedfile@3975588

Fixed Py23DocChecker.

There was a small mistake on Python 2: we basically set 'got = want', which meant the doctests always passed...

Files changed:
M plone/formwidget/namedfile/tests.py
M plone/formwidget/namedfile/widget.rst
Repository: plone.formwidget.namedfile

Branch: refs/heads/master
Date: 2019-03-26T12:43:01+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.formwidget.namedfile@846f5f4

Merge pull request #38 from plone/maurits-issue-2813-plone-protect

Only keep already uploaded image when it is a POST request

Files changed:
A news/2628.bugfix
M plone/formwidget/namedfile/tests.py
M plone/formwidget/namedfile/widget.py
M plone/formwidget/namedfile/widget.rst
@mauritsvanrees
Copy link
Member

Fixed in plone/plone.formwidget.namedfile#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants