Skip to content

Commit

Permalink
Fix the config key case
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmz committed Jan 5, 2025
1 parent bddbdc4 commit 464f560
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v2/CorsProxyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function proxy(ctx: Context) {
const {
timeout: timeoutString,
allowedOrigins,
allowedURlPrefixes,
allowedUrlPrefixes,
allowLocalhostOrigins,
} = currentConfig().corsProxy;

Expand Down Expand Up @@ -48,7 +48,7 @@ export async function proxy(ctx: Context) {
}

// Check if the URL has allowed prefix
if (!allowedURlPrefixes.some((prefix) => url.startsWith(prefix))) {
if (!allowedUrlPrefixes.some((prefix) => url.startsWith(prefix))) {
throw new ValidationException('URL not allowed');
}

Expand Down
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ config.corsProxy = {
// development).
allowLocalhostOrigins: true,
// The allowlist of proxied URL prefixes.
allowedURlPrefixes: [],
allowedUrlPrefixes: [],
};

module.exports = config;
2 changes: 1 addition & 1 deletion test/functional/cors-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('CORS proxy', () => {
withModifiedConfig(() => ({
corsProxy: {
allowedOrigins: ['none', 'http://goodorigin.net'],
allowedURlPrefixes: [`${server.origin}/example`],
allowedUrlPrefixes: [`${server.origin}/example`],
},
}));

Expand Down
2 changes: 1 addition & 1 deletion types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ declare module 'config' {
corsProxy: {
timeout: ISO8601DurationString;
allowedOrigins: string[];
allowedURlPrefixes: string[];
allowedUrlPrefixes: string[];
allowLocalhostOrigins: boolean;
};
};
Expand Down

0 comments on commit 464f560

Please sign in to comment.