Closed GiantCrocodile closed 2 years ago
I can't reproduce the issue. Do you have any plugins? Do you still get same error on plain/starter kit?
@afbora I tried with starterkit and it did work there without issues (3.6.6 and 3.7.0 rc2). Then I retried my own page and I think I found the issue but I don't understand it yet.
Try to select a already uploaded file (instead of upload) which will cause because there are no files uploaded previously (query will fail). If you then try to upload a zip file for first time, it tells you there was an internal error and when you try it a second time with a different zip file, you get the error I have posted in this issue.
I suspect this is related to this query in my blueprint:
children:
type: pages
query: page.childrenAndDrafts
files:
type: files
query: page.children.find('test').images
uploads:
parent: page.children.find('test')
I'm not sure why I have this in (looks like some old code) but I suspect it shouldn't break it?
EDIT: This would then be linked to my tiny comment hook plug in .... looks like I have to investigate this next few days :/.
@GiantCrocodile Did you try childrenAndDrafts
instead children
. I'm pretty sure this issue related with this.
fields:
download:
type: files
query: site.childrenAndDrafts.find('test').images
uploads:
parent: site.childrenAndDrafts.find('test')
@afbora I tried your query and parent example (not just replacing children
with childrenAndDrafts
but also the site
part). This does throw the same error as before. When I just take childrenAndDrafts
instead children
it doesn't help as well.
In case you are interested, I've sent you a minimal example.
This was just example. You need to adapt based your application. childrenAndDrafts
didn't work because test
page is not in root
but under the blog page blog/test
.
⚠️ Note that regular queries cannot find draft pages. You need to use custom queries like index(true)
or childrenAndDrafts
. Following examples should work (tested on your app):
files:
type: files
query: site.index(true).find('blog/test').images
uploads:
parent: site.index(true).find('blog/test')
or
files:
type: files
query: kirby.page('blog').childrenAndDrafts.find('test').images
uploads:
parent: kirby.page('blog').childrenAndDrafts.find('test')
@afbora Now I do understand why it throws an error like Call to a member function createFile() on null
. Thank you for helping with this. I tried different things out and it makes sense now/works now.
When I reduce the field to look like
files:
type: files
it works to upload or select files fine for "kirby-3.7.0-rc.2.zip". Could it be that uploading starterkit-main.zip
fails with an Internal Server Error (see browser console) because it is ~ 11 MB and thus exceeds file limits? If so, is the missing helpful error message by design? After upload it just says:
Fehler
starterkit-main.zip
Es wurden keine Dateien hochgeladen
(Saying "Error starterkit-main.zip No file has been uploaded" without any explanation or hint if it's by design, an server error or some other issue). If this is by design, we can treat it as case closed. Thank you for your great support once again!
(Saying "Error starterkit-main.zip No file has been uploaded" without any explanation or hint if it's by design, an server error or some other issue). If this is by design, we can treat it as case closed.
I think, we should handle/review this in a separate issue.
Description
When you upload kirby-3.7.0-rc.2.zip to a page's file field, you get an error.
Expected behavior
No error when you choose to upload this file.
Screenshots
To reproduce
Your setup
Kirby Version
[3.7.0-rc.2]
Console output
Your system (please complete the following information) Windows 11 WAMP setup
Additional context
If you choose to select a file from a list of existing files, it throws an "Your query must return a set of files" error if the query returns no files. That one might be on purpose/by design.