Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix image url with cloud providers #78

Merged
merged 2 commits into from Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 11 additions & 10 deletions admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js
Expand Up @@ -24,7 +24,6 @@ export default class StrapiUploadAdapter extends Plugin {
* @inheritDoc
*/
init() {

// backendUrl
// uploadUrl
// headers
Expand Down Expand Up @@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a mistake here too? I'm having the same problem now for the src set.

srcset="http://localhost:1337https://SPACE_PATH/870fd27ba154892bc07c9164bbbab4a2.png 64w"

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
);
Expand Down