Fixed #1877: 404 on search index when search is disabled

This commit is contained in:
squidfunk 2020-08-22 17:36:27 +02:00
parent f46334a955
commit 989b8597c5
6 changed files with 32 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.b7ed72fe.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.b7ed72fe.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.a8472eec.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.a8472eec.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.d1f5a259.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.d1f5a259.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.fae956e7.min.js",

View File

@ -183,7 +183,7 @@
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.d1f5a259.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.b7ed72fe.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.a8472eec.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",

View File

@ -237,8 +237,10 @@ export function initialize(config: unknown) {
/* ----------------------------------------------------------------------- */
/* Search worker */
const worker$ = defer(() => {
/* Search worker - only if search is present */
const worker$ = useComponent("search")
.pipe(
switchMap(() => defer(() => {
const index = config.search && config.search.index
? config.search.index
: undefined
@ -262,7 +264,8 @@ export function initialize(config: unknown) {
return of(setupSearchWorker(config.search.worker, {
base$, index$
}))
})
}))
)
/* ----------------------------------------------------------------------- */