aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/keyringer/functions12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 1bc6393..37a33aa 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -333,7 +333,17 @@ function keyringer_get_file {
# Get a new file argument
function keyringer_get_new_file {
- FILE="$(keyringer_filename "$1")"
+ # File must not contain spaces
+ if [ ! -z "$2" ] ; then
+ FILE="`echo "$*" | sed -e 's/ /_/g'`"
+ echo "File $* has spaces, secret will be named as $FILE..."
+ else
+ FILE="$1"
+ fi
+
+ # Sanitize and complete file name
+ FILE="`echo $FILE | sed -e s/[^A-Za-z0-9.]/_/g`"
+ FILE="$(keyringer_filename "$FILE")"
if [ -z "$FILE" ]; then
keyringer_action_usage