diff --git a/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js b/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js index fd7e486..fbc1a43 100644 --- a/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js +++ b/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js @@ -24,7 +24,6 @@ export default class StrapiUploadAdapter extends Plugin { * @inheritDoc */ init() { - // backendUrl // uploadUrl // headers @@ -140,21 +139,23 @@ class Adapter { ); } - const { backendUrl, responsive } = this.options || {}; - - if (response[0].formats && responsive) { - const { name, url, alternativeText, formats } = response[0]; - let urls = { default: backendUrl + url }; - let keys = Object.keys(formats).sort((a, b) => formats[a].width - formats[b].width); + const { name, url, alternativeText, formats, provider } = response[0]; + const defaultUrl = provider !== "local" ? url : backendUrl + url; + + if (formats && responsive) { + let urls = { default: defaultUrl }; + let keys = Object.keys(formats).sort( + (a, b) => formats[a].width - formats[b].width + ); keys.map((k) => (urls[formats[k].width] = backendUrl + formats[k].url)); resolve({ alt: alternativeText || name, urls: urls }); } else { resolve( - response[0].url + url ? { - alt: response[0].alternativeText || response[0].name, - urls: { default: backendUrl + response[0].url }, + alt: alternativeText || name, + urls: { default: defaultUrl }, } : null );