The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(desktop): uploaded faces in the CDN's avatars folder show (#1954)
0xken15d16c7b8d52d5
diff --git a/desktop/lib/super_tabs/profile_model.dart b/desktop/lib/super_tabs/profile_model.dartindex 205bf888c..0443451e2 100644--- a/desktop/lib/super_tabs/profile_model.dart+++ b/desktop/lib/super_tabs/profile_model.dart@@ -3,8 +3,6 @@/// them; a value this build does not know reads as absent.library;-import 'attachment_upload.dart' show kSuperTabAttachmentHost;-/// What a member or agent shows instead of the default.sealed class SuperTabAvatarPicture {const SuperTabAvatarPicture();@@ -27,20 +25,38 @@ const kSuperTabAvatarHost = String.fromEnvironment(defaultValue: 'storage.googleapis.com',);+/// Where the chat files' CDN serves them, the same setting as the chat files'+/// own host. A server without an avatar bucket keeps pictures there too, in+/// [kSuperTabAvatarFolder].+const kSuperTabAvatarCdnHost = String.fromEnvironment(+ 'SUPER_TAB_ATTACHMENTS_HOST',+ defaultValue: 'cdn.harness.autonomous.ai',+);++/// The folder a server without an avatar bucket keeps pictures in, among the+/// chat files (backend avatarLinks.ts): it links nothing outside it.+const kSuperTabAvatarFolder = 'avatars';+/// A picture someone uploaded, through the link a member read carries: https,-/// and only on the avatar host (a private bucket's signed link) or the chat-/// files' CDN (a server without an avatar bucket keeps pictures there, Ken-/// 2026-10-28). Never an outside address.+/// and only on the avatar host (a private bucket's signed link) or in the+/// avatars folder on the chat files' CDN (a server without an avatar bucket,+/// Ken 2026-10-28). Never a chat file, and never an outside address.class SuperTabUploadedAvatar extends SuperTabAvatarPicture {const SuperTabUploadedAvatar._(this.url);final Uri url;static SuperTabUploadedAvatar? of(String value) {final url = Uri.tryParse(value);- return url != null &&- url.scheme == 'https' &&- (url.host == kSuperTabAvatarHost ||- url.host == kSuperTabAttachmentHost)+ if (url == null || url.scheme != 'https') return null;+ if (url.host == kSuperTabAvatarHost) return SuperTabUploadedAvatar._(url);+ final path = url.pathSegments;+ final inFolder =+ path.length > 1 &&+ path.first == kSuperTabAvatarFolder &&+ path+ .skip(1)+ .every((part) => part.isNotEmpty && part != '..' && part != '.');+ return url.host == kSuperTabAvatarCdnHost && inFolder? SuperTabUploadedAvatar._(url): null;}diff --git a/desktop/test/super_tab_profile_model_test.dart b/desktop/test/super_tab_profile_model_test.dartindex cbf739981..00084d6b5 100644--- a/desktop/test/super_tab_profile_model_test.dart+++ b/desktop/test/super_tab_profile_model_test.dart@@ -55,21 +55,24 @@ void main() {read({'kind': 'upload', 'url': 'https://elsewhere.example/a.png'}),isNull,);- // A server without an avatar bucket keeps them with the chat files and- // links them on the chat files' CDN (Ken, 2026-10-28): that host too.+ // A server without an avatar bucket keeps pictures with the chat files,+ // in their avatars folder, on the chat files' CDN (Ken, 2026-10-28):+ // that folder there, and nothing else on the CDN.+ const cdn = 'https://cdn.harness.autonomous.ai/avatars/tab/0123/avatar';expect(- (read({- 'kind': 'upload',- 'url': 'https://cdn.harness.autonomous.ai/avatars/t/a/avatar',- })!- as SuperTabUploadedAvatar)- .url,- Uri.parse('https://cdn.harness.autonomous.ai/avatars/t/a/avatar'),- );- expect(- read({'kind': 'upload', 'url': 'http://cdn.harness.autonomous.ai/a'}),- isNull,+ (read({'kind': 'upload', 'url': cdn})! as SuperTabUploadedAvatar).url,+ Uri.parse(cdn),);+ for (final url in [+ 'https://cdn.harness.autonomous.ai/a.png',+ 'https://cdn.harness.autonomous.ai/super-tabs/tab/0123/photo.png',+ 'http://cdn.harness.autonomous.ai/avatars/tab/0123/avatar',+ 'https://cdn.harness.autonomous.ai/avatars-old/tab/0123/avatar',+ 'https://cdn.harness.autonomous.ai/avatars/',+ 'https://cdn.harness.autonomous.ai/avatars/%2E%2E/super-tabs/photo.png',+ ]) {+ expect(read({'kind': 'upload', 'url': url}), isNull, reason: url);+ }// An upload whose signed link has not come yet shows the default face.expect(read({'kind': 'upload'}), isNull);expect(read('fox'), isNull);