mirror of
https://github.com/strapi/strapi.git
synced 2025-09-02 21:32:43 +00:00
fix: support using mainHash for older versions
This commit is contained in:
parent
85e5d16fda
commit
c815b8ecd2
@ -357,8 +357,11 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
||||
|
||||
// Files formats are stored within the parent file entity
|
||||
if (uploadData?.type) {
|
||||
const condition = uploadData?.id
|
||||
? { id: fileEntitiesMapper[uploadData.id] }
|
||||
: { hash: uploadData.mainHash };
|
||||
const entry: IFile = await strapi.db.query('plugin::upload.file').findOne({
|
||||
where: { id: fileEntitiesMapper[uploadData.id] },
|
||||
where: condition,
|
||||
});
|
||||
const specificFormat = entry?.formats?.[uploadData.type];
|
||||
if (specificFormat) {
|
||||
|
@ -96,7 +96,7 @@ export const createAssetsStream = (strapi: LoadedStrapi): Duplex => {
|
||||
: fileFormat.url;
|
||||
const fileFormatStats = await getFileStats(fileFormatFilepath, isLocalProvider);
|
||||
const fileFormatStream = getFileStream(fileFormatFilepath, isLocalProvider);
|
||||
const metadata = { ...fileFormat, type: format, id: file.id };
|
||||
const metadata = { ...fileFormat, type: format, id: file.id, mainHash: file.hash };
|
||||
yield {
|
||||
metadata,
|
||||
filepath: fileFormatFilepath,
|
||||
|
@ -147,6 +147,7 @@ interface IFile {
|
||||
provider?: string;
|
||||
provider_metadata?: Record<string, unknown>;
|
||||
type?: string;
|
||||
mainHash?: string;
|
||||
}
|
||||
export interface IAsset {
|
||||
filename: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user