-
-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Describe the bug
Sorting files has no effect in files sections when they use the parent option.
To Reproduce
Steps to reproduce the behavior:
- Create a files section with a
parentoption in a page blueprint:
site/blueprints/pages/home.yml
sections:
myfiles:
type: files
parent: site.find('otherpage')- Log into panel and create a 'otherpage' page, then go to the home
- Upload some files to the section
- Drag to sort some files
- Reload. The files didn't save their order
Expected behavior
Files should be manually sortable even if they're saved in another page.
Kirby Version
3.3.6
Console output
no errors or warnings.
Additional context
Looking at network traffic, I see that sorting the files sends a PATCH request to the wrong parent (the "current page", not the real parent of the files). E.g if the section lives in home and the files come from otherpage, the request looks like this:
PATCH /api/pages/home/files/sort
{
"files": [
"otherpage/3.jpg",
"otherpage/2.jpg",
"otherpage/1.jpg"
],
"index":0
}
But I guess it should PATCH to :
PATCH /api/pages/otherpage/files/sort
Inspecting the <KFilesSection> component; the props contain a parent property that seems wrong (it links to the current page). However, in data, there's an options.upload.api value that points to the correct parent.