bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: CESTONARO Thilo <thilo.cestonaro@thalesgroup.com>
To: "bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Cc: CESTONARO Thilo <thilo.cestonaro@thalesgroup.com>
Subject: [PATCH] bitbake: git fetcher: use urllib quote ...
Date: Wed, 22 Mar 2023 08:37:15 +0000	[thread overview]
Message-ID: <PR0P264MB1882D9E54AD24DF72B9E65E5E9869@PR0P264MB1882.FRAP264.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 1216 bytes --]

to use the path url-compatible. This needs to happen before the shell quotation happens.

Without this commit, spaces in the clone URL will be used as " " and not as "%20" which will fail.
This commit changes the " " in the URL to "%20" when it is a http or https url.

Signed-off-by: Thilo Cestonaro <thilo.cestonaro@thalesgroup.com>
---
 lib/bb/fetch2/git.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 578edc59..dc7f848d 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -66,6 +66,7 @@ import re
 import shlex
 import subprocess
 import tempfile
+import urllib
 import bb
 import bb.progress
 from contextlib import contextmanager
@@ -697,7 +698,12 @@ class Git(FetchMethod):
             username = ud.user + '@'
         else:
             username = ""
-        return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path)
+
+        path = ud.path
+        if ud.proto in [ 'http', 'https' ]:
+            path = urllib.parse.quote(ud.path)
+
+        return "%s://%s%s%s" % (ud.proto, username, ud.host, path)

     def _revision_key(self, ud, d, name):
         """
--
2.37.2


[-- Attachment #2: Type: text/html, Size: 3561 bytes --]

             reply	other threads:[~2023-03-22  8:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  8:37 CESTONARO Thilo [this message]
2023-03-22 10:40 ` [bitbake-devel] [PATCH] bitbake: git fetcher: use urllib quote Michael Opdenacker
2023-04-19 12:22   ` AW: " CESTONARO Thilo
2023-03-24 10:13 ` Alexandre Belloni
2023-04-20 11:43 ` Richard Purdie
2023-05-10 13:10   ` [PATCH v2] " CESTONARO Thilo
2023-05-10 13:24     ` [bitbake-devel] " Michael Opdenacker

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=PR0P264MB1882D9E54AD24DF72B9E65E5E9869@PR0P264MB1882.FRAP264.PROD.OUTLOOK.COM \
    --to=thilo.cestonaro@thalesgroup.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /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;
as well as URLs for NNTP newsgroup(s).