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

clashing hash on two CSS/JS packages with the same name on second load when checkForUpdates=true #117

Open
chopki opened this issue Sep 2, 2022 · 1 comment

Comments

@chopki
Copy link

chopki commented Sep 2, 2022

preface - looking for a fix and will pop a pull request if i can nail down whats going on, but thought best to post in case anyone else had come across or had a better working knowledge of cfstatic and could pin it down quicker.

Issue - I have two directories assets\css\core and assets\js\core that both contain lots of files that are set to minify & concatenate down to one file that has been working like a dream forever. Since upgrading to CF 2021 (seems compatible otherwise) it seems on the first load of the application everything works fine, but on the second page load the hash for the JS file gets set to the same as the hash for the CSS file.

e.g output initial load ( hashes 20220826055440 & 20220831091516 )

<link rel="stylesheet" href="https://[domain]/assets/static/core.min.20220826055440.css" media="all" charset="utf-8">
<script type="text/javascript" src="https://[domain]/assets/static/core.min.20220831091516.js" charset="utf-8"></script>

second load ( single hash 20220826055440 )

<link rel="stylesheet" href="https://[domain]/assets/static/core.min.20220826055440.css" media="all" charset="utf-8">
<script type="text/javascript" src="https://[domain]/assets/static/core.min.20220826055440.js" charset="utf-8"></script>

This only seems to happen on the development and staging environments where we set the checkForUpdates parameter to true

initialisation:

<cfset application.cfstatic = new shared.lib.cfstatic.CfStatic(
	staticDirectory     = application.root_path & "assets",
	staticUrl           = application.basehref & "/assets",
	outputDirectory     = "static",
	includeAllByDefault = false,
	forceCompilation    = true,
	checkForUpdates     = application.cfstatic_check_for_update,
	debugAllowed        = true,
	debugKey			= key,
	debugPassword		= pass
)>

Other setup details - Windows / CF 2021 Enterprise

@seybsen
Copy link

seybsen commented Sep 2, 2022

I diffed https://github.com/teamcfadvance/cfstatic/blob/master/org/cfstatic/CfStatic.cfc with our copy of the file. The only thing we changed for CF2021 was this line:

https://github.com/teamcfadvance/cfstatic/blob/master/org/cfstatic/CfStatic.cfc#L211

our timeout is set to 100 instead of 1, but unfortunately I don't really know why this change was made. Could have been because of the same error you are experiencing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants