Avoid breaking the entire UI when naughty characters are present in the file name or directory; closes #2575

This commit is contained in:
Dane Everitt 2020-10-22 21:18:46 -07:00
parent 65d04d0c05
commit 903b5795db
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 78 additions and 39 deletions

View file

@ -1,18 +1,10 @@
import http from '@/api/http';
export default (uuid: string, file: string, content: string): Promise<void> => {
return new Promise((resolve, reject) => {
http.post(
`/api/client/servers/${uuid}/files/write`,
content,
{
params: { file },
headers: {
'Content-Type': 'text/plain',
},
},
)
.then(() => resolve())
.catch(reject);
export default async (uuid: string, file: string, content: string): Promise<void> => {
await http.post(`/api/client/servers/${uuid}/files/write`, content, {
params: { file },
headers: {
'Content-Type': 'text/plain',
},
});
};