Просмотр исходного кода

Merge pull request #2680 from overleaf/jpa-fix-cache-bust

[frontend] fix cache busting: add timestamp unless build id is present

GitOrigin-RevId: ece768cb33af47182b920c894636d686dba02c3b
Eric Mc Sween 6 лет назад
Родитель
Сommit
5527cab2a2
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      services/web/frontend/js/ide/pdf/controllers/PdfController.js

+ 2 - 2
services/web/frontend/js/ide/pdf/controllers/PdfController.js

@@ -455,7 +455,7 @@ define([
           )
           )
         }
         }
         // check if we need to bust cache (build id is unique so don't need it in that case)
         // check if we need to bust cache (build id is unique so don't need it in that case)
-        if (fileByPath['output.pdf'] && fileByPath['output.pdf'].build) {
+        if (!(fileByPath['output.pdf'] && fileByPath['output.pdf'].build)) {
           qs.cache_bust = `${Date.now()}`
           qs.cache_bust = `${Date.now()}`
         }
         }
         // convert the qs hash into a query string and append it
         // convert the qs hash into a query string and append it
@@ -538,7 +538,7 @@ define([
           opts.url = `/project/${$scope.project_id}/output/${name}`
           opts.url = `/project/${$scope.project_id}/output/${name}`
         }
         }
         // check if we need to bust cache (build id is unique so don't need it in that case)
         // check if we need to bust cache (build id is unique so don't need it in that case)
-        if (file && file.build) {
+        if (!(file && file.build)) {
           opts.params.cache_bust = `${Date.now()}`
           opts.params.cache_bust = `${Date.now()}`
         }
         }
         opts.url = buildPdfDownloadUrl(options.pdfDownloadDomain, opts.url)
         opts.url = buildPdfDownloadUrl(options.pdfDownloadDomain, opts.url)