Open sunew opened 6 years ago
I'm able to confirm this is happening in Plone 5.1.2. The cause seems to be the fact that the portlet add/edit screen is in an overlay. The error does not happen otherwise.
I think the better fix would be to edit the Upload panel to have the correct context. This is only an issue if you do not choose an upload location. I also noticed from the root of the site that if I chose an upload location, then cleared it out, it would correctly chooses the root of the site.
Confirmed in 5.0.x as well (duplicate ticket https://github.com/plone/plone.app.content/issues/161)
Confirmed in 5.2b1 as well, you can check it at demo.plone.org
Still confirmed in 5.2.1.
The issue disappears when registering fileUpload
for *
and adding the following at the beginning of FileUploadView.__call__
.
for obj in self.context.aq_chain:
context = obj
if IFolderish.providedBy(context):
break
I'm not sure that this is the right solution, the fix might belong into plone/staticresources/static/components/mockup/mockup/patterns/upload/pattern.js
. If not I'll gladly make a pull-request.
Opinions?
Still present in 5.2.9 and Plone 6.
I would be in favour of solving it in zcml plus Python, like @pbauer writes above. Seems easiest, with the least chance of unexpected side effects.
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
What I did:
I can reproduce in a standard plone 5.1rc2 with no additional modules.
Add a static portlet somewhere in a new plone site. Insert an image: - click the insert image in the tinymce toolbar in the richtext field. Choose the 'upload' tab.
When uploading, this error happens:
In the browser console: Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8089/site/front-page/++contextportlets++plone.rightcolumn/@@fileUpload
clearly either the portlet context (++contextportlets++plone.rightcolumn) for the @@fileUpload view is wrong, or the view needs to be registered more broadly and handle uploads in the context of portlets / portlet managers.
I can work on a fix if I get some guidance to what the best solution is - is this a general problem in the portlet rich text field context, or should it be handled in the @@fileUpload view? My guess is this also affects other cases where a tinymce widget is used on non-content objects (mosaic? not sure about the architecture here).
What I expect to happen:
Successfull upload, with a new image object created in the folder of the context of the portlet. (The folder of the object the portlet is defined on).
What version of Plone/ Addons I am using:
I can reproduce in a standard plone 5.1rc2 with no additional modules.