File Upload API Ignores 'directory' Parameter, Defaults to Root
Current Behavior
When using the client API endpoint to upload a file (/api/client/servers/{server}/files/upload), the API correctly generates a signed URL. However, when a directory parameter is specified (e.g., /missions), the final file upload ignores this parameter and places the file in the server's root directory instead of the specified subdirectory.
This occurs even when the directory parameter is correctly provided as a query parameter in the initial GET request and as a matching form data field in the final POST request, as required by the documentation.
Expected Behavior
Excepted uploaded file to be found in subdirectory instead of default root directory after using the following commands:
curl -X GET "http://panelurl/api/client/servers/56b9a9f1/files/upload?directory=%2Fmissions"
-H "Accept: Application/vnd.pterodactyl.v1+json"
-H "Authorization: Bearer ptlc_YOUR_CLIENT_API_KEY"
curl -X POST "SIGNED_URL_FROM_STEP_1"
-F "files=@/path/to/your/local/file.pbo"
-F "directory=/missions"
Sincere apologies in advance if this is a user error, but does not appear to be as it has been tested multiple times.
Steps to Reproduce
-
Make a GET request to /api/client/servers/{server}/files/upload with the query parameter directory=/your_subdirectory.
-
Receive the signed_url from the API response.
-
Make a POST request to the received signed_url. The request body must be multipart/form-data and contain:
A files field with the file data.
A directory field with the value /subdirectory.
-
The file is uploaded in the root directory instead of the subdirectory
Panel Version
1.11.10
Wings Version
1.11.13
Games and/or Eggs Affected
No response
Docker Image
No response
Error Logs
Is there an existing issue for this?
- [x] I have searched the existing issues before opening this issue.
- [x] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
- [x] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
Hello @vedaanty. First, sorry for commenting on this thread, but I had this issue and this is the first result on Google I got when googling it. It took me a good while to figure out, a bit of messing with the network debug in my browser to see how the web client does it normally. You don't use the directory query parameter when requesting the sign url. You append it to the end of the signed url. So your second curl request would become: curl -X POST "$signed_url&directory=%2Fmissions" -F "files=@/path/to/your/local/file.pbo"
No worries! Went through the same process and figured it out when I marked it as completed! Thanks for the update, I should have added these comments myself as well.