Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const defaultFetchImage = (editor: Editor, img: HTMLImageElement) => {
let src = img.src, apiKey;
if (isCorsImage(editor, img)) {
return Proxy.getUrl(img.src, null, isCorsWithCredentialsImage(editor, img));
}
if (!isLocalImage(editor, img)) {
src = Settings.getProxyUrl(editor);
src += (src.indexOf('?') === -1 ? '?' : '&') + 'url=' + encodeURIComponent(img.src);
apiKey = Settings.getApiKey(editor);
return Proxy.getUrl(src, apiKey, false);
}
return BlobConversions.imageToBlob(img);
};