From b458e06feb6f340a6cfe961bb1e281e674fa5ec9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 2 May 2020 16:44:46 +0000 Subject: [PATCH] Remove spaces from patch filename --- git.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/git.py b/git.py index d31ed8803..7cd204312 100644 --- a/git.py +++ b/git.py @@ -88,7 +88,9 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str, for line in patchLines: if line.startswith('Subject:'): patchSubject = \ - line.replace('Subject:', '').replace('/', '|').strip() + line.replace('Subject:', '').replace('/', '|') + patchSubject = patchSubject.replace('[PATCH]', '').strip() + patchSubject = patchSubject.replace(' ', '_') projectName = \ getGitProjectName(baseDir, nickname, domain, subject) patchDir = \ @@ -99,9 +101,7 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str, break if not patchFilename: return False - patchFile = open(patchFilename, "w") - if not patchFile: - return False - patchFile.write(contentStr) - patchFile.close() - return True + with open(patchFilename, "w") as patchFile: + patchFile.write(contentStr) + return True + return False