public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] fix #3747: download_file_from_url: trim whitespace before comparing checksum
Date: Thu,  2 Dec 2021 14:38:42 +0100	[thread overview]
Message-ID: <20211202133842.1000372-1-o.bektas@proxmox.com> (raw)

so that we don't get checksum mismatch in case the user accidentally
copies whitespace in the checksum field.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
 src/PVE/Tools.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 787942a..fa14f2f 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1921,6 +1921,7 @@ sub download_file_from_url {
 	if (defined($opts->{"${_}sum"})) {
 	    $checksum_algorithm = $_;
 	    $checksum_expected = $opts->{"${_}sum"};
+	    $checksum_expected =~ s/^\s+|\s+$//g;
 	    last;
 	}
     }
-- 
2.30.2





             reply	other threads:[~2021-12-02 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 13:38 Oguz Bektas [this message]
2021-12-03  8:03 ` Fabian Ebner
2021-12-03  9:20   ` Fabian Grünbichler
2021-12-03 10:11   ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202133842.1000372-1-o.bektas@proxmox.com \
    --to=o.bektas@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal