Ensure provider is always assigned on uploaded file

Previously the uploaded file data was assigned a provider in the conditional block that calculated dimensions on supported images. This caused the provider to be stored as null in the database for some image uploads such as SVG. The provider property is now assigned unconditionally
This commit is contained in:
Nick Frasser 2022-03-21 23:22:47 -04:00
parent 6df5d8d11f
commit 8747947cf3
No known key found for this signature in database
GPG Key ID: 0ECCB0A0367E74AA

View File

@ -189,11 +189,11 @@ module.exports = ({ strapi }) => ({
const { width, height } = await getDimensions(fileData);
_.assign(fileData, {
provider: config.provider,
width,
height,
});
}
_.set(fileData, 'provider', config.provider);
return this.add(fileData, { user });
},
@ -285,11 +285,11 @@ module.exports = ({ strapi }) => ({
const { width, height } = await getDimensions(fileData);
_.assign(fileData, {
provider: config.provider,
width,
height,
});
}
_.set(fileData, 'provider', config.provider);
} finally {
// delete temporary folder
await fse.remove(tmpWorkingDirectory);