diff --git a/packages/server/src/api/controllers/static/index.ts b/packages/server/src/api/controllers/static/index.ts
index 1d04811019..daf7b9b25c 100644
--- a/packages/server/src/api/controllers/static/index.ts
+++ b/packages/server/src/api/controllers/static/index.ts
@@ -145,6 +145,16 @@ const requiresMigration = async (ctx: Ctx) => {
}
export const serveApp = async function (ctx: UserCtx) {
+ if (ctx.url.includes("apple-touch-icon.png")) {
+ ctx.redirect("/builder/bblogo.png")
+ return
+ }
+ // no app ID found, cannot serve - return message instead
+ if (!context.getAppId()) {
+ ctx.body = "No content found - requires app ID"
+ return
+ }
+
const needMigrations = await requiresMigration(ctx)
const bbHeaderEmbed =
diff --git a/packages/server/src/api/routes/tests/static.spec.ts b/packages/server/src/api/routes/tests/static.spec.ts
index 62b72b2b8f..c2808603e9 100644
--- a/packages/server/src/api/routes/tests/static.spec.ts
+++ b/packages/server/src/api/routes/tests/static.spec.ts
@@ -152,4 +152,22 @@ describe("/static", () => {
expect(res.body.builderPreview).toBe(true)
})
})
+
+ describe("/", () => {
+ it("should move permanently from base call (public call)", async () => {
+ const res = await request.get(`/`)
+ expect(res.status).toEqual(301)
+ expect(res.text).toEqual(
+ `Redirecting to /builder.`
+ )
+ })
+
+ it("should not error when trying to get 'apple-touch-icon.png' (public call)", async () => {
+ const res = await request.get(`/apple-touch-icon.png`)
+ expect(res.status).toEqual(302)
+ expect(res.text).toEqual(
+ `Redirecting to /builder/bblogo.png.`
+ )
+ })
+ })
})
diff --git a/packages/server/src/sdk/app/applications/applications.ts b/packages/server/src/sdk/app/applications/applications.ts
index 07e303ccdd..1a705a211e 100644
--- a/packages/server/src/sdk/app/applications/applications.ts
+++ b/packages/server/src/sdk/app/applications/applications.ts
@@ -25,10 +25,12 @@ export async function fetch(status: AppStatus, user: ContextUser) {
const all = status === AppStatus.ALL
let apps = (await dbCore.getAllApps({ dev, all })) as App[]
- const enrichedUser = await groups.enrichUserRolesFromGroups({
+ // need to type this correctly - add roles back in to convert from ContextUser to User
+ const completeUser: User = {
...user,
- roles: user.roles || {},
- })
+ roles: user?.roles || {},
+ }
+ const enrichedUser = await groups.enrichUserRolesFromGroups(completeUser)
apps = filterAppList(enrichedUser, apps)
const appIds = apps