?
avatar laoneo
laoneo
27 Jul 2021

When adding a url into the image field of an article which has no extension, then the preview image is not rendered. This is the case for example with google drive which creates urls like https://drive.google.com/uc?id=dr123&export=download.

image

Issue appears since #34634.

@dgrammatiko any idea?

avatar laoneo laoneo - open - 27 Jul 2021
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jul 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Jul 2021
avatar laoneo laoneo - change - 27 Jul 2021
The description was changed
avatar laoneo laoneo - edited - 27 Jul 2021
avatar dgrammatiko
dgrammatiko - comment - 27 Jul 2021

Might be

previewElement.src = /http/.test(value) ? value : Joomla.getOptions('system.paths').rootFull + value;

Check what the value is there (maybe you have to remove the hash part of the url)

avatar laoneo
laoneo - comment - 27 Jul 2021

Problem is that the extension can't be determined here

so it will not even arrive on 212.

avatar dgrammatiko
dgrammatiko - comment - 27 Jul 2021

@laoneo pass me some some valid URL in DM (tweeter or whatever)

avatar dgrammatiko
dgrammatiko - comment - 27 Jul 2021

@laoneo this should do it:

const getExtension = (path) => {
  const parts = path.split(/[#]/);
  if (parts.length) {
    const clean = parts[1].split(/[\?]/);
     return clean[0].split('.').pop().trim()
  }
  return path.split(/[#?]/)[0].split('.').pop().trim();
}
avatar laoneo
laoneo - comment - 27 Jul 2021

It does, do you make a pr?

avatar dgrammatiko
dgrammatiko - comment - 27 Jul 2021

sure

avatar dgrammatiko
dgrammatiko - comment - 27 Jul 2021

@laoneo done: #34922

avatar richard67 richard67 - close - 27 Jul 2021
avatar richard67
richard67 - comment - 27 Jul 2021

Closing as having a pull request. Please test #34922 . Thanks in advance.

avatar richard67 richard67 - change - 27 Jul 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-07-27 10:24:10
Closed_By richard67

Add a Comment

Login with GitHub to post a comment