diff --git a/apps/server/src/project/ProjectFaviconResolver.test.ts b/apps/server/src/project/ProjectFaviconResolver.test.ts
index 973ef659655e0..372bc75aab184 100644
--- a/apps/server/src/project/ProjectFaviconResolver.test.ts
+++ b/apps/server/src/project/ProjectFaviconResolver.test.ts
@@ -65,6 +65,19 @@ it.layer(layerTest)("ProjectFaviconResolverLive", (it) => {
}),
);
+ it.effect("skips a candidate under a file where its folder should be", () =>
+ Effect.gen(function* () {
+ const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
+ const path = yield* Path.Path;
+ const cwd = yield* makeTempDir;
+ // An empty `.idea` file: stat of `.idea/icon.svg` fails with ENOTDIR.
+ yield* writeTextFile(cwd, ".idea", "");
+ yield* writeTextFile(cwd, "AppIcon.icns", "icon");
+
+ expect(yield* resolver.resolvePath(cwd)).toBe(path.join(cwd, "AppIcon.icns"));
+ }),
+ );
+
it.effect("falls back at once when a cached favicon is deleted", () =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
diff --git a/apps/server/src/project/ProjectFaviconResolver.ts b/apps/server/src/project/ProjectFaviconResolver.ts
index e9b8f6d6a9637..9232c6f6ed8f4 100644
--- a/apps/server/src/project/ProjectFaviconResolver.ts
+++ b/apps/server/src/project/ProjectFaviconResolver.ts
@@ -10,6 +10,7 @@ import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Path from "effect/Path";
import * as PlatformError from "effect/PlatformError";
+import * as Predicate from "effect/Predicate";
import * as Schema from "effect/Schema";
import * as WorkspacePaths from "../workspace/WorkspacePaths.ts";
@@ -130,6 +131,12 @@ function extractIconHref(source: string): string | null {
return null;
}
+// t4 fork: a file where the path needs a folder (an empty `.idea` file) means the path is absent too.
+const isNotDirectory = (error: PlatformError.PlatformError) =>
+ error.reason._tag === "BadResource" &&
+ Predicate.hasProperty(error.reason.cause, "code") &&
+ error.reason.cause.code === "ENOTDIR";
+
export const optionOnNotFound = (
effect: Effect.Effect,
): Effect.Effect, PlatformError.PlatformError, R> =>
@@ -137,7 +144,9 @@ export const optionOnNotFound = (
Effect.asSome,
Effect.catchTags({
PlatformError: (error) =>
- error.reason._tag === "NotFound" ? Effect.succeed(Option.none()) : Effect.fail(error),
+ error.reason._tag === "NotFound" || isNotDirectory(error)
+ ? Effect.succeed(Option.none())
+ : Effect.fail(error),
}),
);
diff --git a/apps/server/src/t4/frameAncestors.ts b/apps/server/src/t4/frameAncestors.ts
index 7947f43995ff6..e7eb136ec2e35 100644
--- a/apps/server/src/t4/frameAncestors.ts
+++ b/apps/server/src/t4/frameAncestors.ts
@@ -1,15 +1,7 @@
// @effect-diagnostics processEnvInEffect:off -- t4 settings come from the client container's env.
-/**
- * Who may frame T3's web app (AI-131).
- *
- * Upstream v0.1.11 (#36395) answers every HTML page with `frame-ancestors
- * 'none'` and `X-Frame-Options: DENY`, so no site can frame it. The t4
- * dashboard opens T3 in a full-screen frame on a phone (`T3Frame.tsx`), and
- * after the v0.1.11 rollout that frame was a white screen. `T4_FRAME_ANCESTORS`
- * (compose) lists the origins allowed to frame T3 - the dashboard's - and every
- * other site is still refused. X-Frame-Options has no allow-list, so it is left
- * out when origins are named; browsers that read `frame-ancestors` ignore it.
- */
+// t4 fork: upstream sends `frame-ancestors 'none'`, which blanks the t4 dashboard's phone frame.
+// T4_FRAME_ANCESTORS names the origins allowed to frame T3; every other site is still refused.
+// X-Frame-Options has no allow-list, so it is left out when origins are named.
const ORIGIN = /^https?:\/\/[a-z0-9.-]+(?::\d{1,5})?$/i;