Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file name parsing #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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