diff --git a/components/server/src/container-module.ts b/components/server/src/container-module.ts index f0fa281810528d..e30d2835b3a89a 100644 --- a/components/server/src/container-module.ts +++ b/components/server/src/container-module.ts @@ -81,7 +81,6 @@ import { GitTokenValidator } from "./workspace/git-token-validator"; import { newAnalyticsWriterFromEnv } from "@gitpod/gitpod-protocol/lib/util/analytics"; import { OAuthController } from "./oauth-server/oauth-controller"; import { ImageBuildPrefixContextParser } from "./workspace/imagebuild-prefix-context-parser"; -import { AdditionalContentPrefixContextParser } from "./workspace/additional-content-prefix-context-parser"; import { HeadlessLogService } from "./workspace/headless-log-service"; import { HeadlessLogController } from "./workspace/headless-log-controller"; import { IAnalyticsWriter } from "@gitpod/gitpod-protocol/lib/analytics"; @@ -188,7 +187,6 @@ export const productionContainerModule = new ContainerModule((bind, unbind, isBo bind(IPrefixContextParser).to(ReferrerPrefixParser).inSingletonScope(); bind(IPrefixContextParser).to(EnvvarPrefixParser).inSingletonScope(); bind(IPrefixContextParser).to(ImageBuildPrefixContextParser).inSingletonScope(); - bind(IPrefixContextParser).to(AdditionalContentPrefixContextParser).inSingletonScope(); bind(GitTokenScopeGuesser).toSelf().inSingletonScope(); bind(GitTokenValidator).toSelf().inSingletonScope(); diff --git a/components/server/src/workspace/additional-content-prefix-context-parser.ts b/components/server/src/workspace/additional-content-prefix-context-parser.ts deleted file mode 100644 index 7df2f3ac9029a4..00000000000000 --- a/components/server/src/workspace/additional-content-prefix-context-parser.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2021 Gitpod GmbH. All rights reserved. - * Licensed under the GNU Affero General Public License (AGPL). - * See License-AGPL.txt in the project root for license information. - */ - -import { AdditionalContentContext, User, WorkspaceContext } from "@gitpod/gitpod-protocol"; -import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; -import { base64decode } from "@jmondi/oauth2-server"; -import { inject, injectable } from "inversify"; -import { Config } from "../config"; -import { IPrefixContextParser } from "./context-parser"; - -/** - * mostly for testing purpose - */ -@injectable() -export class AdditionalContentPrefixContextParser implements IPrefixContextParser { - @inject(Config) protected readonly config: Config; - static PREFIX = /^\/?additionalcontent\/([^\/]*)\//; - - findPrefix(user: User, context: string): string | undefined { - if (this.config.hostUrl.url.host !== "gitpod.io") { - const result = AdditionalContentPrefixContextParser.PREFIX.exec(context); - if (result) { - return result[0]; - } - } - return undefined; - } - - public async handle(user: User, prefix: string, context: WorkspaceContext): Promise { - const match = AdditionalContentPrefixContextParser.PREFIX.exec(prefix); - if (!match) { - log.error("Could not parse prefix " + prefix); - return context; - } - const text = base64decode(decodeURIComponent(match[1])); - const files = JSON.parse(text); - (context as AdditionalContentContext).additionalFiles = files; - return context; - } -}