Minor bugs
parent
f051e3de6b
commit
82faee9baa
|
@ -77,7 +77,7 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
|||
},
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Error while reading file", name, e);
|
||||
// console.error("Error while reading file", name, e);
|
||||
throw Error(`Could not read file ${name}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,7 @@ export function storeSyscalls(
|
|||
"store.deletePrefix": async (_ctx, prefix: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "?%"`,
|
||||
prefix,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
);
|
||||
},
|
||||
"store.deleteQuery": async (_ctx, query: Query) => {
|
||||
|
@ -153,8 +152,7 @@ export function storeSyscalls(
|
|||
return (
|
||||
await asyncQuery<Item>(
|
||||
db,
|
||||
`SELECT key, value FROM ${tableName} WHERE key LIKE "?%"`,
|
||||
prefix,
|
||||
`SELECT key, value FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
)
|
||||
).map(({ key, value }) => ({
|
||||
key,
|
||||
|
|
|
@ -354,7 +354,6 @@ export class ExpressServer {
|
|||
|
||||
// Fallback, serve index.html
|
||||
this.app.use((ctx) => {
|
||||
console.log("Here!!");
|
||||
return ctx.send({
|
||||
root: "/",
|
||||
path: `${this.distDir}/index.html`,
|
||||
|
@ -480,7 +479,7 @@ function buildFsRouter(spacePrimitives: SpacePrimitives): Router {
|
|||
});
|
||||
|
||||
fsRouter
|
||||
.get("\/(.+)", async ({ params, request, response }, next) => {
|
||||
.get("\/(.+)", async ({ params, request, response }) => {
|
||||
let name = params[0];
|
||||
console.log("Loading file", name);
|
||||
try {
|
||||
|
@ -496,9 +495,10 @@ function buildFsRouter(spacePrimitives: SpacePrimitives): Router {
|
|||
response.headers.set("X-Permission", attachmentData.meta.perm);
|
||||
response.headers.set("Content-Type", attachmentData.meta.contentType);
|
||||
response.body = attachmentData.data as ArrayBuffer;
|
||||
} catch (e: any) {
|
||||
console.error("Error in main router", e);
|
||||
next();
|
||||
} catch {
|
||||
// console.error("Error in main router", e);
|
||||
response.status = 404;
|
||||
response.body = "";
|
||||
}
|
||||
})
|
||||
.put("\/(.+)", async ({ request, response, params }) => {
|
||||
|
|
|
@ -83,8 +83,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
|||
return (
|
||||
await asyncQuery<Item>(
|
||||
db,
|
||||
`SELECT key, page, value FROM ${tableName} WHERE key LIKE "?%"`,
|
||||
prefix,
|
||||
`SELECT key, page, value FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
)
|
||||
).map(({ key, value, page }) => ({
|
||||
key,
|
||||
|
@ -112,8 +111,7 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
|||
"index.deletePrefixForPage": async (ctx, page: string, prefix: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "?%" AND page = ?`,
|
||||
prefix,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "${prefix}%" AND page = ?`,
|
||||
page,
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue