summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mga-advisor.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/mga-advisor.py b/mga-advisor.py
index a8e01c5..8f30f0d 100644
--- a/mga-advisor.py
+++ b/mga-advisor.py
@@ -136,7 +136,7 @@ class Widget(QWidget):
cve = cve.strip()
if cve != "":
self.ui.list_cve.addItem(cve)
- self.ui.list_ref.addItem(f"https://bugs.mageia.org/show_bug.cgi?id={self.ui.bug_le.text()}")
+ self.ui.list_ref.addItem(os.path.join(BASE_URL, self.ui.bug_le.text()) )
for url in re.split(';|,| ', r.json()['bugs'][0]['url']):
url = url.strip()
if url != "":
@@ -257,9 +257,15 @@ class Widget(QWidget):
def export(self):
if QDir().mkpath(QDir().homePath() + "/mageia-advisories/advisories"):
if self.ui.bug_le.text() != "":
- #TODO check that it exists
- with open(f"{QDir().homePath()}/mageia-advisories/advisories/{self.ui.bug_le.text()}.adv", 'w') as f:
+
+ filename = f"{QDir().homePath()}/mageia-advisories/advisories/{self.ui.bug_le.text()}.adv"
+ if os.path.exists(filename):
+ response = QMessageBox.question(self, 'File exists', f'The file {filename} already exists. Do you want to override it ?', QMessageBox.Yes | QMessageBox.No)
+ if response == QMessageBox.No:
+ return
+ with open(filename, 'w') as f:
f.write(self.adv_text())
+ QMessageBox.information(self, 'Success', f'The file {filename} has been written!')
def cancel(self):
self.close()