Skip to content

Commit e82a356

Browse files
committed
retry search decryption in case 'encryptcontent-index' does not exist yet
1 parent 9e8efd2 commit e82a356

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

encryptcontent/decrypt-contents.tpl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function base64url_decode(input) {
289289

290290
{% if experimental -%}
291291
/* Decrypt part of the search index and refresh it for search engine */
292-
{% if webcrypto %}async {% endif %}function decrypt_search(keys) {
292+
{% if webcrypto %}async {% endif %}function decrypt_search(keys, retry=true) {
293293
let sessionIndex = sessionStorage.getItem('encryptcontent-index');
294294
let could_decrypt = false;
295295
if (sessionIndex) {
@@ -323,6 +323,10 @@ function base64url_decode(input) {
323323
window.location.reload();
324324
}
325325
}
326+
} else if (retry) {
327+
setTimeout(() => { //retry after one second if 'encryptcontent-index' not available yet
328+
decrypt_search(keys, false);
329+
}, 1000);
326330
}
327331
};
328332
{%- endif %}

0 commit comments

Comments
 (0)