diff options
| author | Xiao Pan <gky44px1999@gmail.com> | 2024-02-26 08:39:17 +0000 | 
|---|---|---|
| committer | Xiao Pan <gky44px1999@gmail.com> | 2024-02-26 08:39:17 +0000 | 
| commit | 05c13b57cb36039ce01ba8524986b326a70b39e3 (patch) | |
| tree | 77ccdd2e150d3903bba0dd66a7f72aa2fadd9279 | |
| parent | e8397da4e90432209cb716c8470c0781c25b2874 (diff) | |
fix: wrong script location
In about-formatting-edited.sh, `pwd` when cgit run this script is /,  can be tested by `cat '<p>$(pwd)</p>'`
so need to get those scripts location via $0, $0 is /usr/lib/cgit/filters/about-formatting-edited.sh
| -rwxr-xr-x | usr/lib/cgit/filters/about-formatting-edited.sh | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/usr/lib/cgit/filters/about-formatting-edited.sh b/usr/lib/cgit/filters/about-formatting-edited.sh index 2622abaa..e919e54d 100755 --- a/usr/lib/cgit/filters/about-formatting-edited.sh +++ b/usr/lib/cgit/filters/about-formatting-edited.sh @@ -17,10 +17,13 @@  # CGIT_REPO_SECTION    ( = section        setting )  # CGIT_REPO_CLONE_URL  ( = repo.clone-url setting ) +# note `pwd` when cgit run this script is /,  can be tested by `cat '<p>$(pwd)</p>'` +# so need to get those scripts location via $0, $0 is /usr/lib/cgit/filters/about-formatting-edited.sh +dir="$(dirname "$0")/html-converters/"  case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in  	*.markdown|*.mdown|*.md|*.mkd) exec cmark;; -#	*.rst) exec ./html-converters/rst2html;; -	*.[1-9]) exec ./html-converters/man2html;; +#	*.rst) exec "$dir/rst2html";; +	*.[1-9]) exec "$dir/man2html";;  	*.htm|*.html) exec cat;; -	*.txt|*) exec ./html-converters/txt2html;; +	*.txt|*) exec "$dir/txt2html";;  esac  | 
