Skip to content

Commit

Permalink
fix: file name parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentina K committed Apr 18, 2023
1 parent 69dde7c commit fe2beb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pages/api/avatar/[name].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function (req: NextRequest) {
const name = url.searchParams.get("name");
const text = url.searchParams.get("text");
const size = Number(url.searchParams.get("size") || "120");
const [username, type] = name?.split(".") || [];
const { 0: username, length, [length - 1]: type }: { length: number, [key: number]: string } = name?.split(".") || [];
const fileType = type?.includes("svg") ? "svg" : "png";

const gradient = generateGradient(username || Math.random() + "");
Expand Down

0 comments on commit fe2beb4

Please sign in to comment.