Skip to content

Commit 82371f9

Browse files
committed
update site to use files instead of pastes as docs suggest
1 parent 54c4dfd commit 82371f9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

mystbin/backend/utils/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async def get_paste(self, paste_id: str, password: Optional[str] = None) -> Opti
172172
"""
173173
contents = cast(List[asyncpg.Record], await self._do_query(query, paste_id, conn=conn))
174174
resp = dict(resp[0])
175-
resp["pastes"] = [{a: str(b) for a, b in x.items()} for x in contents]
175+
resp["files"] = [{a: str(b) for a, b in x.items()} for x in contents]
176176

177177
return resp
178178
else:

mystbin/frontend/pages/[pid].tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function Pastey(props: PropsWithoutRef<{ paste }>) {
2121
content: "This is a password protected paste.",
2222
});
2323
} else {
24-
for (let file of paste["pastes"]) {
24+
for (let file of paste["files"]) {
2525
initialData.push({ title: file["filename"], content: file["content"] });
2626
}
2727
}
@@ -67,9 +67,10 @@ export default function Pastey(props: PropsWithoutRef<{ paste }>) {
6767
}
6868

6969
export const getServerSideProps: GetServerSideProps = async ({ query }) => {
70-
const { pid } = query;
70+
const { _pid } = query;
71+
let pid = _pid.toString().split(".", 1)[0];
7172
const response = await fetch(
72-
`${config["site"]["backend_site"]}/paste/${pid.toString().split(".", 1)[0]}`
73+
`${config["site"]["backend_site"]}/paste/${pid}`
7374
);
7475

7576
if (response.status === 404) {

0 commit comments

Comments
 (0)