Fix hang if non-existing label is searched.
parent
0a07c43cdf
commit
c66afedb17
2
README
2
README
|
@ -24,6 +24,8 @@ The solution is to allow the web server user to execute a single command as anot
|
||||||
* the command-line interface, that is run on the server by a user with read access to the documents;
|
* the command-line interface, that is run on the server by a user with read access to the documents;
|
||||||
* the web interface, that is run on the web server, with no access to the documents save through the CLI interface.
|
* the web interface, that is run on the web server, with no access to the documents save through the CLI interface.
|
||||||
|
|
||||||
|
Finally, all the input (search terms, etc.) is verified by the CLI script, so that any number of frontends can be written and benefit from the same strict controls.
|
||||||
|
|
||||||
= INSTALLATION AND DEPENDENCIES =
|
= INSTALLATION AND DEPENDENCIES =
|
||||||
|
|
||||||
The script may be copied anywhere. Its dependencies are standard, although I only tested on Debian: bash, find, gawk, sed, grep, file, ls.
|
The script may be copied anywhere. Its dependencies are standard, although I only tested on Debian: bash, find, gawk, sed, grep, file, ls.
|
||||||
|
|
|
@ -102,7 +102,7 @@ Q)
|
||||||
if [ ${#labels[*]} -gt 0 ]; then
|
if [ ${#labels[*]} -gt 0 ]; then
|
||||||
# This is an AND
|
# This is an AND
|
||||||
for l in "${labels[@]}"; do
|
for l in "${labels[@]}"; do
|
||||||
found="$(
|
[ -n "$found" ] && found="$(
|
||||||
eval grep -lF${q_ci:+i}e "$l" ${found//|/labels} 2>/dev/null \
|
eval grep -lF${q_ci:+i}e "$l" ${found//|/labels} 2>/dev/null \
|
||||||
| sed 's#labels$#|#')"
|
| sed 's#labels$#|#')"
|
||||||
done
|
done
|
||||||
|
@ -111,7 +111,7 @@ Q)
|
||||||
# eval grep -lF${q_ci:+i}f <(printf '%s\n' "${labels[@]}") ${found//|/labels} 2>/dev/null \
|
# eval grep -lF${q_ci:+i}f <(printf '%s\n' "${labels[@]}") ${found//|/labels} 2>/dev/null \
|
||||||
# | sed 's#labels$#|#')"
|
# | sed 's#labels$#|#')"
|
||||||
fi
|
fi
|
||||||
if [ ${#words[*]} -gt 0 ]; then
|
if [ ${#words[*]} -gt 0 ] && [ -n "$found" ]; then
|
||||||
# This is an AND
|
# This is an AND
|
||||||
tmpf="$(
|
tmpf="$(
|
||||||
eval grep -Ho "'>[^<>]*</span'" ${found//|/paper.*.words} 2>/dev/null \
|
eval grep -Ho "'>[^<>]*</span'" ${found//|/paper.*.words} 2>/dev/null \
|
||||||
|
|
Loading…
Reference in New Issue