Skip to content

Commit f98379d

Browse files
committed
fix(mutt): use _comp_dequote for safe eval
In addition, `eval` can be applied to only the content of `spoolfile`, which was originally extracted from the mutt output of the form `spoolfile="..."`. After expanding the escape sequences in $spoolfile, we combine it with `cur`.
1 parent 63924e6 commit f98379d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

completions/mutt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ _comp_cmd_mutt__filedir()
136136
elif [[ $cur == !* ]]; then
137137
spoolfile="$("$muttcmd" -F "$muttrc" -Q spoolfile 2>/dev/null |
138138
command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|')"
139-
[[ $spoolfile ]] && eval cur="${cur/#!/$spoolfile}"
139+
if [[ $spoolfile ]]; then
140+
_comp_dequote "\"$spoolfile\"" && spoolfile=$REPLY
141+
cur="${cur/#!/$spoolfile}"
142+
fi
140143
fi
141144
_comp_compgen -c "$cur" filedir
142145
}

0 commit comments

Comments
 (0)