]> git.plutz.net Git - confetti/commitdiff
bugfix: find actual UID in files
authorPaul Hänsch <paul@plutz.net>
Sun, 12 May 2024 15:48:40 +0000 (17:48 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 12 May 2024 15:48:40 +0000 (17:48 +0200)
ledgers/iban_assign.sh

index 9faf22303bf6bda48b0f0b9f394ec704b9e692ce..8d9ae99d0ec52585965f64baa7b679b2d0af2c42 100755 (executable)
@@ -8,6 +8,7 @@ UIDLIST="$(
   | sed -Ez '
     s/\nBEGIN;:VCARD\n([^\n]+\n)*FN;:([^\n]+)\n([^\n]+\n)*UID;:([^\n]+)\n([^\n]+\n)*END;:VCARD\n/UID:\4 FN:\2/g
   '
+  echo
 )"
 
 # printf '%s\r\n' "Content-Type: text/plain" ""
@@ -31,7 +32,8 @@ esac; done
     fn="$(POST "fn_${use}")"
     uid="${UIDLIST%% FN:"$fn"${BR}*}" uid="${uid##*${BR}UID:}"
   
-    cfile="${_DATA}/vcard/${uid}.vcf"
+    # cfile="${_DATA}/vcard/${uid}.vcf"
+    cfile="$(grep -lxF "UID;:${uid}" "${_DATA}/vcard/"*.vcf || grep -lxF "UID:${uid}" "${_DATA}/vcard/"*.vcf)"
     if SLOCK "$cfile" >/dev/null; then
       card="$(pdi_load "$cfile")"
       cnum="$(pdi_count "$card" X-IBAN)"