fix: correctly pass-through preview URLs

pull/1049/head
Paul Makles 2022-07-10 13:57:47 +01:00
parent 093f0580f8
commit 2d3eb46d6b
1 changed files with 5 additions and 3 deletions

View File

@ -120,7 +120,9 @@ export function FileUploader(props: Props) {
const [uploading, setUploading] = useState(false); const [uploading, setUploading] = useState(false);
const [previewFile, setPreviewFile] = useState<File>(null!); const [previewFile, setPreviewFile] = useState<File>(null!);
const [generatedPreviewURL, setGeneratedPreviewURL] = useState(""); const [generatedPreviewURL, setGeneratedPreviewURL] = useState<
string | undefined
>(undefined);
useEffect(() => { useEffect(() => {
if (previewFile) { if (previewFile) {
const url: string = URL.createObjectURL(previewFile); const url: string = URL.createObjectURL(previewFile);
@ -291,8 +293,8 @@ export function FileUploader(props: Props) {
backgroundImage: backgroundImage:
style === "icon" style === "icon"
? `url('${ ? `url('${
generatedPreviewURL ?? generatedPreviewURL ||
previewURL ?? previewURL ||
defaultPreview defaultPreview
}')` }')`
: previewURL : previewURL