mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-06-04 09:50:09 +00:00
fix(security): escape path parameters
This commit is contained in:
@@ -1053,6 +1053,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const StickerPackApplicationId = '710982414301790216';
|
||||
|
||||
export enum ImageFormat {
|
||||
@@ -1350,6 +1361,17 @@ export const CDNRoutes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(CDNRoutes);
|
||||
|
||||
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
|
||||
|
||||
@@ -519,3 +519,14 @@ export const Routes = {
|
||||
return `/oauth2/applications/@me`;
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
@@ -777,6 +777,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const RouteBases = {
|
||||
api: `https://discord.com/api/v${APIVersion}`,
|
||||
cdn: 'https://cdn.discordapp.com',
|
||||
|
||||
@@ -1062,6 +1062,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const StickerPackApplicationId = '710982414301790216';
|
||||
|
||||
export enum ImageFormat {
|
||||
@@ -1359,6 +1370,17 @@ export const CDNRoutes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(CDNRoutes);
|
||||
|
||||
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
|
||||
|
||||
@@ -1053,6 +1053,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const StickerPackApplicationId = '710982414301790216';
|
||||
|
||||
export enum ImageFormat {
|
||||
@@ -1350,6 +1361,17 @@ export const CDNRoutes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(CDNRoutes);
|
||||
|
||||
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
|
||||
|
||||
@@ -519,3 +519,14 @@ export const Routes = {
|
||||
return `/oauth2/applications/@me`;
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
@@ -777,6 +777,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const RouteBases = {
|
||||
api: `https://discord.com/api/v${APIVersion}`,
|
||||
cdn: 'https://cdn.discordapp.com',
|
||||
|
||||
@@ -1062,6 +1062,17 @@ export const Routes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(Routes);
|
||||
|
||||
export const StickerPackApplicationId = '710982414301790216';
|
||||
|
||||
export enum ImageFormat {
|
||||
@@ -1359,6 +1370,17 @@ export const CDNRoutes = {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
}
|
||||
|
||||
// Freeze the object so it can't be changed
|
||||
Object.freeze(CDNRoutes);
|
||||
|
||||
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
|
||||
|
||||
Reference in New Issue
Block a user