aboutsummaryrefslogtreecommitdiffstats
path: root/src/web
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-11-16 08:31:35 -0600
committerGitHub <noreply@github.com>2026-11-16 08:31:35 -0600
commit1d092bf0b18ba44c0547838715a721900cb4a569 (patch)
tree9880a9f83cd6c809f2b7cdd954661055780643fd /src/web
parentabffd0c9c24a7b5d20962fc979c6eb581dcad9dd (diff)
parent0bfe5062ea6cc3d3dadef7c88497c2a15a573ece (diff)
downloadslskd-1d092bf0b18ba44c0547838715a721900cb4a569.tar.gz
Merge branch 'master' into relay
Diffstat (limited to 'src/web')
-rw-r--r--src/web/src/lib/files.js15
-rw-r--r--src/web/src/lib/rooms.js2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/web/src/lib/files.js b/src/web/src/lib/files.js
index 99a82b2c..cbd0bd3c 100644
--- a/src/web/src/lib/files.js
+++ b/src/web/src/lib/files.js
@@ -1,21 +1,30 @@
import api from './api';
+// paths may contain any unicode character, so they are encoded as UTF-8 before base64 (btoa only accepts Latin-1),
+// and the result is URL-encoded because base64 may contain '/', which would otherwise split the route
+
export const list = async ({ root, subdirectory = '' }) => {
const response = (
- await api.get(`/files/${root}/directories/${btoa(subdirectory)}`)
+ await api.get(
+ `/files/${root}/directories/${encodeURIComponent(btoa(String.fromCodePoint(...new TextEncoder().encode(subdirectory))))}`,
+ )
).data;
return response;
};
export const deleteDirectory = async ({ root, path }) => {
- const response = await api.delete(`/files/${root}/directories/${btoa(path)}`);
+ const response = await api.delete(
+ `/files/${root}/directories/${encodeURIComponent(btoa(String.fromCodePoint(...new TextEncoder().encode(path))))}`,
+ );
return response;
};
export const deleteFile = async ({ root, path }) => {
- const response = await api.delete(`/files/${root}/files/${btoa(path)}`);
+ const response = await api.delete(
+ `/files/${root}/files/${encodeURIComponent(btoa(String.fromCodePoint(...new TextEncoder().encode(path))))}`,
+ );
return response;
};
diff --git a/src/web/src/lib/rooms.js b/src/web/src/lib/rooms.js
index 35da6701..3c6c22cb 100644
--- a/src/web/src/lib/rooms.js
+++ b/src/web/src/lib/rooms.js
@@ -49,7 +49,7 @@ export const getUsers = async ({ roomName }) => {
};
export const join = async ({ roomName }) => {
- return api.post('/rooms/joined', roomName);
+ return api.post('/rooms/joined', JSON.stringify(roomName));
};
export const leave = async ({ roomName }) => {