简体   繁体   English

资产:资产文件末尾过多的0x00字符

[英]Assetic: excessive 0x00 characters at the end of asset files

I using Symfony 3 with Assetic under Vagrant box with Debian as guest and Windows as host. 我将Symfony 3与Assetic在Vagrant框下使用,Debian作为来宾,Windows作为宿主。 I set assetic.use_controller to false to speed up loading web pages in dev environment. 我将assetic.use_controller设置为false以加快在开发环境中加载网页的速度。 When I run assetic:dump, it refreshes the assets properly, but adds random amount of 0x00 characters to the end of some asset files. 当我运行assetic:dump时,它会正确刷新资产,但会在某些资产文件的末尾随机添加0x00字符。 So when I refreshing the page in browser, I get javascript error "Uncaught SyntaxError: Invalid or unexpected token". 因此,当我在浏览器中刷新页面时,出现javascript错误“未捕获的SyntaxError:无效或意外的令牌”。 Here is the screenshot from chrome's console: 这是chrome控制台的屏幕截图:

这是chrome控制台的屏幕截图

Those red dots are characters with 0 code. 那些红点是带有0码的字符。 It appears with random length in some js files. 在某些js文件中,它以随机长度显示。

If I manually remove assets directory and run assetic:dump again, then the problem disappears. 如果我手动删除资产目录并再次运行assetic:dump,则问题消失。

I think I can write custom symfony command to remove assets directory and then run assetic:dump from inside of it, but it does not help if I will use great command assetic:watch. 我想我可以编写自定义symfony命令来删除资产目录,然后从其内部运行assetic:dump,但是如果我要使用出色的命令assetic:watch,这将无济于事。

Can anyone help? 有人可以帮忙吗?

SOLUTION: I found that it's not an Assetic bug. 解决方案:我发现这不是Assetic错误。 Actually, problem was found in Nginx. 实际上,在Nginx中发现了问题。 I solved it by changing it's config like described at serverfault.com . 我通过更改其配置来解决它,如serverfault.com所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM