Skip to content

Commit

Permalink
fix: restrict staked asset bank icons to png
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Feb 2, 2025
1 parent 93bb586 commit 1420820
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const CreateStakedPoolForm = ({ isLoading, validatorPubKeys, onSubmit }:
onDrop,
accept: {
"image/png": [".png"],
"image/jpeg": [".jpg", ".jpeg"],
},
maxFiles: 1,
maxSize: 1 * 1024 * 1024, // 1MB
Expand Down Expand Up @@ -173,15 +172,18 @@ export const CreateStakedPoolForm = ({ isLoading, validatorPubKeys, onSubmit }:
<input {...getInputProps()} />
<IconPhoto size={24} />
</div>
<p className="text-sm text-muted-foreground">
<p className="text-sm">
{form.assetLogo ? (
`File: ${form.assetLogo.name}`
) : isMobile ? (
"Tap to select an image"
) : (
<div>
<p>Drop an image here or click to select</p>
<p className="text-xs">Max file size: 1MB</p>
<p>Drop a PNG image here or click to select</p>
<ul className="text-xs text-muted-foreground">
<li>Supported file types: PNG</li>
<li>Max file size: 1MB</li>
</ul>
</div>
)}
</p>
Expand Down
2 changes: 1 addition & 1 deletion apps/marginfi-v2-ui/src/pages/api/stakedPools/addImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
action: "write",
expires: Date.now() + 5 * 60 * 1000, // 5 minutes,
fields: { "x-goog-meta-source": "nextjs-project" },
contentType: "image/(png|jpeg)", // Allow both PNG and JPEG
contentType: "image/png",
};
const [response] = await file.generateSignedPostPolicyV4(options);
res.status(200).json(response);
Expand Down

0 comments on commit 1420820

Please sign in to comment.