Skip to content

Commit

Permalink
SD Connect compatibility added to a-put and a-get
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimmo Mattila committed Nov 28, 2024
1 parent 31ed648 commit b14a6b4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions a-get
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,14 @@ if [[ $is_tar_file -eq 1 ]]; then
sd-lock-util unlock --container "${locked_path}" --no-content-download --no-preserve-original --path "${locked_file}"
exitcode=$?
unlocked_file="${locked_file:0:(-5)}"
mv $unlocked_file a-get_download_$$_tmp.zst
rm -f "$locked_file"
if [[ -e $ unlocked_file ]]; then
mv $unlocked_file a-get_download_$$_tmp.zst
rm -f "$locked_file"
else
echo "Decryption of $unlocked_file failed."
echo "This is probably now SD Connect encrypted file"
exitcode=1
fi
fi

if [[ $exitcode -ne 0 ]]; then
Expand Down Expand Up @@ -627,13 +633,15 @@ else
sd-lock-util unlock --container "${locked_path}" --no-content-download --no-preserve-original --path "${locked_file}"
exitcode=$?
unlocked_file="${locked_file:0:(-5)}"
if [[ "$unlocked_file" != "$target_name" ]]; then
mv "$unlocked_file" "$target_name"
fi
rm -f "$locked_file"
if [[ $exitcode -ne 0 ]]; then
echo "SD connect based decryption failed"
if [[ -e $unlocked_file ]]; then
if [[ "$unlocked_file" != "$target_name" ]]; then
mv "$unlocked_file" "$target_name"
fi
else
echo "SD connect based decryption failed."
exitcode=1
fi
rm -f "$locked_file"
else
if [[ ${target_name:0:1} != "/" ]]; then
#this is needed to cope with file names containing :
Expand Down

0 comments on commit b14a6b4

Please sign in to comment.