Skip to content

[bug] doesn't open files with option names #11

@averms

Description

@averms

If I have a file with -h as the name it won't open. The below patch fixes this problem.

diff --git a/xdg-open b/xdg-open
index a30b3ec..2a318df 100755
--- a/xdg-open
+++ b/xdg-open
@@ -73,7 +73,7 @@ fi
 
 if [[ -e "$arg" ]]; then
 	# file or dir
-	mime="$(file -ib "$arg" | cut -d';' -f1)"
+	mime="$(file -ib -- "$arg" | cut -d';' -f1)"
 	if [[ -f "$arg" ]]; then
 		ext="$(tr '[:upper:]' '[:lower:]' <<< "${arg##*.}")"
 	fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions