iamkubi / pydactyl

Python wrapper for the Pterodactyl Panel API
MIT License
67 stars 21 forks source link

Files API endpoint incorrectly quotes data #54

Closed Crumb5 closed 1 year ago

Crumb5 commented 2 years ago

Describe the bug files api endpoint incorrectly quotes file contents "eula=true" != eula=true Data is being passed as json and not text

To Reproduce

api.client.servers.files.write_file(server_id="abcd1234",path="eula.txt", contents="eula=true")

"eula=true" != eula=true

Expected behavior File contents should be unquoted

Environment

This is what i did to get it to work: https://github.com/iamkubi/pydactyl/blob/7f65673af7b437a8d51c57f1d92ce164d83ede22/pydactyl/api/base.py#L81

            if 'files/write' not in url:
                response = self._session.post(url, params=params, headers=headers,
                                            json=data)
            else:
                headers['Content-Type']="application/text"
                response = self._session.post(url, params=params, headers=headers, 
                                            data=data)