Skip to content

Commit

Permalink
stripSpecialCharacters upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Jun 16, 2024
1 parent f61c48f commit a0c1ed2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/dashboard/src/components/team-avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CardHeader,
CardTitle,
} from "@midday/ui/card";
import { stripSpecialCharacters } from "@midday/utils";
import { Loader2 } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
import { useRef } from "react";
Expand All @@ -23,9 +24,11 @@ export function TeamAvatar({ teamId, logoUrl, name }) {
const { files } = evt.target;
const selectedFile = files as FileList;

const filename = stripSpecialCharacters(selectedFile[0]?.name);

const { url } = await uploadFile({
bucket: "avatars",
path: [teamId, selectedFile[0]?.name],
path: [teamId, filename],
file: selectedFile[0] as File,
});

Expand Down
5 changes: 4 additions & 1 deletion apps/dashboard/src/components/user-avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CardHeader,
CardTitle,
} from "@midday/ui/card";
import { stripSpecialCharacters } from "@midday/utils";
import { Loader2 } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
import { useRef } from "react";
Expand All @@ -23,9 +24,11 @@ export function UserAvatar({ userId, avatarUrl, fullName }) {
const { files } = evt.target;
const selectedFile = files as FileList;

const filename = stripSpecialCharacters(selectedFile[0]?.name);

const { url } = await uploadFile({
bucket: "avatars",
path: [userId, selectedFile[0]?.name],
path: [userId, filename],
file: selectedFile[0] as File,
});

Expand Down

0 comments on commit a0c1ed2

Please sign in to comment.