diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-06-30 12:55:29 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-06-30 12:58:43 +0200 |
commit | 4c8552b11477141777101e0e0609dd1f32d191e9 (patch) | |
tree | a9aa88b7a97b1ac65b7515e274430f10e0c409fd | |
parent | 34e4742f0caab0d3eb9efd00fce4157d112617b5 (diff) | |
download | hugo-4c8552b11477141777101e0e0609dd1f32d191e9.tar.gz hugo-4c8552b11477141777101e0e0609dd1f32d191e9.zip |
Fix Cloudflare vs Netlify cache dir issue
Re-add the additional environment checks to determine if its Netlify. Seems that Cloudflare also sets `NETLIFY=true`.
This makes it look, basically, like a variant of the conditional we had before we started fixing this, but I have checked this logic on Netlify now and it should work.
Fixes #8714
-rw-r--r-- | helpers/path.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/helpers/path.go b/helpers/path.go index 6d4827bd2..b504f5251 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -412,8 +412,10 @@ func getCacheDir(cfg config.Provider) string { return addTrailingFileSeparator(cacheDir) } - // This is always set to true when running on Netlify. - if os.Getenv("NETLIFY") == "true" { + // See Issue #8714. + // Turns out that Cloudflare also sets NETLIFY=true in its build environment, + // but all of these 3 should not give any false positives. + if os.Getenv("NETLIFY") == "true" && os.Getenv("PULL_REQUEST") != "" && os.Getenv("DEPLOY_PRIME_URL") != "" { // Netlify's cache behaviour is not documented, the currently best example // is this project: // https://github.com/philhawksworth/content-shards/blob/master/gulpfile.js |