Package: yad
Version: 0.27.0-1.1
Severity: normal

--- Please enter the report below this line. ---

When using yad with forms, passing variables with spaces to the fields (to pre-fill them), the order of them are messed up in a nasty way (namely, when a space is found, the rest of the string is passed to the next field), even if the variable is quoted.

This behaviour can be confirmed by using paths without spaces. Even, replacing the space(s) with underscore ("_") in the string with "FILENAME=${FILENAME/' '/'_'}" will fill the form properly,
but the file path is actually invalid.

--- System information. ---
Architecture: amd64
Kernel: Linux 4.2.3-custom

Debian Release: stretch/sid
1 experimental ftp.debian.org
1 experimental ftp.cl.debian.org

--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.
#!/bin/bash

#
# UploadFile-yad - simple script to call UploadFile using yad
#
#  (c) 2015 Davod - https://commons.wikimedia.org/wiki/User:Amitie_10g
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

IFS='|' read -r -a FILES <<< $(yad --width=800 --height=600 --file-selection 
--title="Select a File" --multiple --item-separator=';')

INDEX=0;
for FILENAME in "${FILES[@]}"
do
        LIST[$INDEX]="$(yad --width=1024 --height=800 --title='Enter 
information' --text='Please enter the file information' \
        --image=$FILENAME \
        --form --date-format='%Y-%m-%d' --separator=';' --quoted-output \
        --field='Filename':RO $FILENAME \
        --field='Pagename' ${FILENAME##*/} \
        --field='Description:':TXT \
        --field='Date':DT {{subst:#time:Y-m-d}} \
        --field='Source' \
        --field='Author' \
        --field='Other info' \
        --field='License:':TXT \
        --field='Categories')"
        
        INDEX=$INDEX+1
done

printf '%s\n' $(echo "${LIST[@]}\n") | ./UploadFile --filelist=stdin

Reply via email to