Bug 109437

Summary: xdg-open open_generic_xdg_x_scheme_handler has unquoted `[ -n $scheme ]` test
Product: Portland Reporter: Dominic Evans <oldmanuk>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: 1.1.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Dominic Evans 2019-01-22 11:44:39 UTC
xgd-open v1.1.3

A -n test doesn't work with unquoted arguments. The `$scheme` must be double-quoted:

open_generic_xdg_x_scheme_handler()
{
    scheme="`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'`"
    if [ -n $scheme ]; then
        filetype="x-scheme-handler/$scheme"
        open_generic_xdg_mime "$1" "$filetype"
    fi
}

I'd suggest `if [ -n "${scheme:-}" ]; then`


Ref: https://github.com/koalaman/shellcheck/wiki/SC2070
Comment 1 GitLab Migration User 2019-02-16 13:40:57 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/142.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.