-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
AssetManager appendTimestamp not working #18414
Comments
Might be what was already reported in #18402 |
yes but my issue contains the actual error to reproduce. |
Я с английским не дружу, но надеюсь, что разработчики поймут. Я столкнулся с аналогичной проблемой: в версии Yii Basic 2.0.38 всё работает, с версии Yii Basic 2.0.39 перестает. PHP 7.3. Настройки сайта, да и вообще код не меняется, т.е. делаю даунгрейд до 2.0.38 - работает, следом делаю апгрейд до 2.0.39.3 - перестает работать. В попытках найти проблему я наткнулся на очень интересную вещь: у меня проблема проявляется только тогда, когда сайт лежит в подпапке, т.е. в
Магия происходит в файле
В случае с подпапкой эта часть Т.е. I decided to translate it additionally through a translator. I ran into a similar problem: in Yii Basic version 2.0.38 everything works, from Yii Basic version 2.0.39 it stops. PHP 7.3. Site settings, and indeed the code does not change, i.e. I downgrade to 2.0.38 - it works, then I upgrade to 2.0.39.3 - it stops working. While trying to find the problem, I came across a very interesting thing: my problem appears only when the site is in a subfolder, i.e. in
The magic happens in the file
In the case of a subfolder, this part Those |
Спасибо за дополнительную информацию. Наверняка в ближайшее время это исправят 😄 |
Будем надеяться, что нам остаётся :) |
Исправить и сделать pull request. |
Added a pullrequest, maybe you can have a look at it? |
…on-empty BaseUrl. The issue was discussed here yiisoft/yii2#18414
I have same issue with no empty baseUrl Project structure (advanced based)
Backend config:
.htaccess
Asset Bundles or files included like registerJsFile('@web/...') has't timestamp param. |
@g-rodigy this was fixed in 2.0.40 please update and try again |
@Isitar thanks, this works, I thought it was fixed in the previous version |
What steps will reproduce the problem?
asset-config:
web.php
What is the expected result?
the site.min.css with the query parameter
v=time()
<link href="/my-project/web/css/site.min.css?v=123" rel="stylesheet">
What do you get instead?
no timestamp:
<link href="/my-project/web/css/site.min.css" rel="stylesheet">
Additional info
this happens because of Line 495 in View.php (https://github.com/yiisoft/yii2/blob/master/framework/web/View.php#L495) it adds
@webroot
to the url. But the Url comes from the AssetManager (newly introducedgetActualAssetUrl
method (yii2/framework/web/AssetManager.php
Line 643 in c46d209
which already includes the
@webroot
(or other baseUrl) in the url.The error occours now because the AssetBundle calls this new Method which is the url without the timestamp. In earlier versions the timestamp was alredy included in the $url and no errors occoured.
Possible fixes:
getAssetUrl
method in the AssetBundle@webroot
in front of the url.Btw: is there a unit test checking the appendTimestamp behavior?
The text was updated successfully, but these errors were encountered: