Ticket #7109 (closed Bug: fixed)

Opened 4 years ago

Last modified 8 months ago

deleting content named index_html in a folder through action dropdown deletes parent instead

Reported by: ivo Owned by:
Priority: major Milestone: 4.1
Component: Infrastructure Version:
Keywords: Cc: stxnext

Description

  • Create a clean portal
  • Create a folder 'foo'
  • In foo, create a document "index_html"
  • Within the index_html context (i.e. <portal>/foo/index_html/edit) choose "delete" from the actions dropdown
  • Plone will delete the parentfolder ("foo"), not index_html

The same will happen with "rename".

Similar behaviour has been reported in Plone 3.x

Attachments

actions.xml.diff Download (2.6 KB) - added by stxnext 3 years ago.
Diff for actions.xml file

Change History

comment:1 Changed 3 years ago by stxnext

  • Owner changed from optilude to stxnext

comment:2 Changed 3 years ago by stxnext

  • Owner changed from stxnext to optilude

Very similar behavior exists when you use any actions from dropdown menu (e.g. cut, copy, delete, rename) on object selected as default view.

To reproduce:

  • Create a folder 'bar'
  • In 'bar', create a document (any title e.g.: 'test')
  • In 'bar' select 'test' as default view
  • In 'test' context (/bar/test/view) choose "delete" from the actions dropdown
  • Plone will delete the parent folder ('bar'), not default view

To fix this in all actions defined in portal_actions/object_buttons the 'URL (Expression)' should be set to 'string:$object_url/...' (e.g.: 'string:$object_url/delete_confirmation'). Now this expression uses "${globals_view/getCurrentObjectUrl}" function which returns url to parent folder if object is selected as default view.

This actions are defined in default Plone profile's 'actions.xml' file. Diff file attached.

Probably new migration profile will be needed.

Changed 3 years ago by stxnext

Diff for actions.xml file

comment:3 Changed 3 years ago by kleist

Since I've seen a lot of madness related to "index_html", I'm no longer using that name. Mabe it's time to retire the special treatment of "index_html", now that we have default views?

But it's part of Zope (or CMF?) rather than Plone, eh?

comment:4 Changed 3 years ago by stxnext

  • Cc stxnext added

comment:5 Changed 3 years ago by hannosch

  • Component changed from Navigation/Folder listings to Infrastructure

comment:6 Changed 2 years ago by optilude

  • Owner optilude deleted

Sorry, this has been stuck with me, but it's not something I'll have time to look into.

comment:7 Changed 9 months ago by WouterVH

This is still happening on Plone 4.0.x and Plone 4.1-trunk

comment:8 Changed 9 months ago by kleist

  • Milestone changed from 3.3.x to 4.x

Bumping prio to "Critical" (dataloss!).

comment:9 Changed 8 months ago by WouterVH

The proposed changes to actions.xml solves the issues.

Fixed for Plone 4.1RC3: Product.CMFPlone-trunk r50132 + plone.app.upgrade-trunk r50133

comment:10 Changed 8 months ago by WouterVH

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from 4.x to 4.1

comment:11 Changed 8 months ago by WouterVH

there is a test testPortalCreation.py that is testing exactly the behaviour we want to fix

    def testObjectButtonActionsOnDefaultDocumentApplyToParent(self):
        # only a manager would have proper permissions
        self.setRoles(['Manager', 'Member'])
        self.folder.invokeFactory('Document','index_html')
        acts = self.actions.listFilteredActionsFor(self.folder.index_html)
        buttons = acts['object_buttons']
        self.assertEqual(len(buttons), 4)
        urls = [a['url'] for a in buttons]
        for url in urls:
            self.failIf('index_html' in url, 'Action wrongly applied to default page object %s'%url)

I changed this into the opposite r50181

    def testObjectButtonActionsOnDefaultDocumentDoNotApplyToParent(self):
        # only a manager would have proper permissions
        self.setRoles(['Manager', 'Member'])
        self.folder.invokeFactory('Document','index_html')
        acts = self.actions.listFilteredActionsFor(self.folder.index_html)
        buttons = acts['object_buttons']
        self.assertEqual(len(buttons), 4)
        urls = [a['url'] for a in buttons]
        for url in urls:
            self.failIf('index_html' not in url, 'Action wrongly applied to parent object %s'%url)
Note: See TracTickets for help on using tickets.