Skip to content

Commit

Permalink
TOOLS/mpv_identify.sh: handle forward slash in property names
Browse files Browse the repository at this point in the history
Property names contain '-' characters, which are translated into
underscores because POSIX shell variables cannot contain hyphens.

We should do the same thing for forward slash characters (i.e. '/')
because these also cannot be present in the names of shell variables.

Fixes: mpv-player#15782
  • Loading branch information
Traneptora committed Feb 4, 2025
1 parent 86383ae commit f9fe895
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TOOLS/mpv_identify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ EOF
local key
for key in $allprops; do
propstr="${propstr}X-MIDENTIFY: $key \${=$key}$LF"
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
unset "$nextprefix$key"
done

Expand All @@ -112,7 +112,7 @@ EOF
fileindex="$((fileindex+1))"
nextprefix="${nextprefix}${fileindex}_"
for key in $allprops; do
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
unset "$nextprefix$key"
done
else
Expand All @@ -126,7 +126,7 @@ EOF
local key="${line#X-MIDENTIFY: }"
local value="${key#* }"
key="${key%% *}"
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
if [ -n "$nextprefix" ]; then
if [ -z "$prefix" ]; then
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"
Expand Down

0 comments on commit f9fe895

Please sign in to comment.