joomtools / plg_system_jtaldef

Automatic local download external files
GNU General Public License v3.0
16 stars 6 forks source link

Favicon code removed from Joomla head #10

Closed snaut22 closed 1 year ago

snaut22 commented 1 year ago

Hi,

plugin works fine, except that favicon code is removed from Joomla head after plugin activation. Like <link href="https://www.musterdomain.at/images/icon.png" rel="shortcut icon" type="image/png" sizes="any" />

Thanks for your help!

degobbis commented 1 year ago

Hi, sorry, but I cannot reproduce the issue. I added your link to the head in Protostar and Cassiopeia and it was not removed.

snaut22 commented 1 year ago

Hi Guido, here is the full original code of the header, it might help:

<!-- joomla head -->
   <link href="https://musterdomain.at/images/icon.png" rel="shortcut icon" type="image/png" sizes="any" /><link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css2?family=Ropa+Sans:ital,wght@0,400;1,400&display=swap" rel="stylesheet" type="text/css" />
<link href="https://musterdomain.at/media/system/css/joomla-fontawesome.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" />
<link href="https://use.fontawesome.com/releases/v6.2.0/css/all.css" data-version="6.2.0" rel="stylesheet" type="text/css" />
<link href="https://musterdomain.at/media/templates/site/tp_easy/css/compiled-901cb97c530df6ff377f9a49a4c09cd4.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" />
<link href="https://musterdomain.at/media/astroid/assets/vendor/astroid/css/debug.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" />
<link href="https://musterdomain.at/media/templates/site/tp_easy/css/compiled-dbb71e3836394a80bbece49d2d30c5be.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" />
 <!-- head styles -->

And this after plugin activation:

 <!-- joomla head -->
   <link href="/media/plg_system_jtaldef/index/css/673adc3de02420cdd3df57a3b39e3e04.css?260665e4365cc4e1e2391a306a22334d" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="/media/plg_system_jtaldef/index/css/673adc3de02420cdd3df57a3b39e3e04.css?260665e4365cc4e1e2391a306a22334d" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="/media/plg_system_jtaldef/index/css/673adc3de02420cdd3df57a3b39e3e04.css?260665e4365cc4e1e2391a306a22334d" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="https://musterdomain.at/media/system/css/joomla-fontawesome.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="/media/plg_system_jtaldef/index/css/fontawesome-v6.2.0-all.css?60fda11bc8c6af8938c0f42d05a32cdf" data-version="6.2.0" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="https://musterdomain.at/media/templates/site/tp_easy/css/compiled-901cb97c530df6ff377f9a49a4c09cd4.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="https://musterdomain.at/media/astroid/assets/vendor/astroid/css/debug.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
<link href="https://musterdomain.at/media/templates/site/tp_easy/css/compiled-dbb71e3836394a80bbece49d2d30c5be.css?e9f3c2476322ea574b407689a02666d5" rel="stylesheet" type="text/css" data-jtaldef-processed="2.0.3"/>
 <!-- head styles -->

Greatly appreciate your help! Daniel

degobbis commented 1 year ago

Error found. In the first line the two links are without line break. My regex can't keep them apart. Maybe you know better how to create regex and can fix this. https://regex101.com/r/Z4O6aB/1 https://github.com/joomtools/plg_system_jtaldef/blob/master/src/plugins/system/jtaldef/jtaldef.php#L326

degobbis commented 1 year ago

Can you please test changing the regex in this line as follows and report? https://github.com/joomtools/plg_system_jtaldef/blob/master/src/plugins/system/jtaldef/jtaldef.php#L326 $searches[] = '%<link\s+(?:[^>]*?\s+)?href=(["\'])[^>]*?(' . $search . ').*?\1*>%';

snaut22 commented 1 year ago

Works perfectly, thank you so much for very quick solution! 👍 And happy holidays!