fix(backend-proxy): fix SVGs are not shown (#4206)

This commit is contained in:
Patrick Walsh 2020-08-27 02:02:56 -06:00 committed by GitHub
parent f43c8d8648
commit 7e950a2ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ import {
APIError,
unsentRequest,
UnpublishedEntry,
blobToFileObj,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
@ -38,7 +39,8 @@ const deserializeMediaFile = ({ id, content, encoding, path, name }: MediaFile)
byteArray[i] = decodedContent.charCodeAt(i);
}
}
const file = new File([byteArray], name);
const blob = new Blob([byteArray]);
const file = blobToFileObj(name, blob);
const url = URL.createObjectURL(file);
return { id, name, path, file, size: file.size, url, displayURL: url };
};