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