feat: Allow data imports larger than the standard attachment size (#4449)

* feat: Allow data imports larger than the standard attachment size

* Use correct preset for data imports

* Cleanup of expired attachments

* lint
This commit is contained in:
Tom Moor
2022-11-20 09:22:57 -08:00
committed by GitHub
parent 1f49bd167d
commit 6e36ffb706
18 changed files with 375 additions and 92 deletions

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import Dropzone from "react-dropzone";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { AttachmentPreset } from "@shared/types";
import Flex from "~/components/Flex";
import LoadingIndicator from "~/components/LoadingIndicator";
import useStores from "~/hooks/useStores";
@@ -39,6 +40,7 @@ function DropToImport({ disabled, onSubmit, children, format }: Props) {
try {
const attachment = await uploadFile(file, {
name: file.name,
preset: AttachmentPreset.Import,
});
await collections.import(attachment.id, format);
onSubmit();

View File

@@ -5,6 +5,7 @@ import * as React from "react";
import AvatarEditor from "react-avatar-editor";
import Dropzone from "react-dropzone";
import styled from "styled-components";
import { AttachmentPreset } from "@shared/types";
import { AttachmentValidation } from "@shared/validations";
import RootStore from "~/stores/RootStore";
import Button from "~/components/Button";
@@ -67,7 +68,7 @@ class ImageUpload extends React.Component<RootStore & Props> {
});
const attachment = await uploadFile(compressed, {
name: this.file.name,
public: true,
preset: AttachmentPreset.Avatar,
});
this.props.onSuccess(attachment.url);
} catch (err) {