plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
246 stars 187 forks source link

Default view not used for File/Image when workflow is in use #1949

Closed abosio closed 7 years ago

abosio commented 7 years ago

BUG/PROBLEM REPORT

What I did:

  1. In the ZMI, set File or Image types to use a workflow such as (Default) or plone_workflow.
  2. In the site, add a File or Image.
  3. Change the workflow state on the File/Image

What I expect to happen:

State should be changed and default view for File/Image should be used: /view

What actually happened:

State is changed but browser is redirected directly to the object, causing only the Image (or PDF) to load in the browser or triggering immediate download of a File not supported for viewing in the browser.

What version of Plone/ Addons I am using:

I'm happy to contribute a PR but would appreciate any assistance finding the cause.

IKholopov commented 7 years ago

When the workflow state is changed, the Plone redirects browser to the url set in action "View", which can be found in the ZMI 'portal_types/Image' (or File), "Actions" tab. It is set by default to 'string:${object_url}', changing it to 'string:${object_url}/view' seems to fix the issue without any drawbacks. However, this tab seems to be deprecated and will be removed in the future.

abosio commented 7 years ago

Yes, thank you. And I see that the /view was included in the actions in the version of plone.app.contenttypes that shipped with Plone 4.3.11. I'm going to investigate further to see if a PR for this change would be appropriate. Additional comments on that from anyone are welcome.

Found this related Issue on plone.app.contenttypes.