dist-git/ensure_gitrepo_namespaced.patch
2017-10-26 17:42:14 +02:00

39 lines
1.2 KiB
Diff

From 15ec38ca2cb761ca02eb75d6a31565f894bf2f00 Mon Sep 17 00:00:00 2001
From: clime <clime@redhat.com>
Date: Thu, 26 Oct 2017 17:06:04 +0200
Subject: [PATCH] patch for Fedora
---
scripts/httpd/upload.cgi | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/httpd/upload.cgi b/scripts/httpd/upload.cgi
index 1de12a3..78f3ba9 100644
--- a/scripts/httpd/upload.cgi
+++ b/scripts/httpd/upload.cgi
@@ -91,6 +91,13 @@ def makedirs(dir_, username, mode=02755):
send_error(str(e))
+def ensure_namespaced(name):
+ name_parts = name.split('/')
+ if len(name_parts) == 1:
+ return 'rpms/'+name
+ return name
+
+
def main():
config = ConfigParser()
config.read('/etc/dist-git/dist-git.conf')
@@ -165,7 +172,7 @@ def main():
msgpath = os.path.join(name, filename, hash_type, checksum, filename)
# first test if the module really exists
- git_dir = os.path.join(config['dist-git']['gitroot_dir'], '%s.git' % name)
+ git_dir = os.path.join(config['dist-git']['gitroot_dir'], '%s.git' % ensure_namespaced(name))
if not os.path.isdir(git_dir):
sys.stderr.write('[username=%s] Unknown module: %s' % (username, name))
send_error('Module "%s" does not exist!' % name,
--
2.9.5