No propagate, fix 'attachment save' cancel
* Quote: Ensure that clicks don't propagate to parent * Attachment Save: Check for null; returned if user cancels out
This commit is contained in:
parent
95d393ee89
commit
bfa76b05d2
3 changed files with 29 additions and 7 deletions
|
@ -339,7 +339,7 @@ export const save = async ({
|
|||
name: string;
|
||||
}) => Promise<{ name: string; fullPath: string }>;
|
||||
timestamp?: number;
|
||||
}): Promise<string> => {
|
||||
}): Promise<string | null> => {
|
||||
if (!attachment.path && !attachment.data) {
|
||||
throw new Error('Attachment had neither path nor data');
|
||||
}
|
||||
|
@ -349,12 +349,16 @@ export const save = async ({
|
|||
: attachment.data;
|
||||
const name = getSuggestedFilename({ attachment, timestamp, index });
|
||||
|
||||
const { fullPath } = await saveAttachmentToDisk({
|
||||
const result = await saveAttachmentToDisk({
|
||||
data,
|
||||
name,
|
||||
});
|
||||
|
||||
return fullPath;
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return result.fullPath;
|
||||
};
|
||||
|
||||
export const getSuggestedFilename = ({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue