1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-04 23:10:13 +01:00

Add max files limit per share

This commit is contained in:
Elias Schneider 2022-04-30 20:03:09 +02:00
parent 4cf67db6a3
commit 7ddce593f9
No known key found for this signature in database
GPG Key ID: D5EC1C72D93244FD
3 changed files with 7 additions and 3 deletions

View File

@ -65,7 +65,11 @@ const Dropzone = ({
disabled={isUploading}
openRef={openRef as ForwardedRef<() => void>}
onDrop={(files) => {
setFiles(files);
if (files.length > 100) {
toast.error("You can't upload more than 100 files per share.");
} else {
setFiles(files);
}
}}
className={classes.dropzone}
radius="md"

View File

@ -17,7 +17,7 @@ const FileList = ({
};
const rows = files.map((file, i) => (
<tr key={file.name}>
<tr key={i}>
<td>{file.name}</td>
<td>{file.type}</td>
<td>{bytesToSize(file.size)}</td>

View File

@ -20,7 +20,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
addVisitorCount(shareId);
const fileListWithoutPreview = (await awServer.storage.listFiles(shareId))
const fileListWithoutPreview = (await awServer.storage.listFiles(shareId, undefined, 100))
.files;
for (const file of fileListWithoutPreview) {