fix: incorrect backup regex
* More accurate backup regex. Fixed an issue with picking up other backups when the names partially match. * More accurate backup regex 2.pull/1158/head
parent
e71179a2d4
commit
06097316ec
|
|
@ -560,8 +560,8 @@ def API_getAllWireguardConfigurationBackup():
|
||||||
files.sort(key=lambda x: x[1], reverse=True)
|
files.sort(key=lambda x: x[1], reverse=True)
|
||||||
|
|
||||||
for f, ct in files:
|
for f, ct in files:
|
||||||
if RegexMatch(r"^(.*)_(.*)\.(conf)$", f):
|
if RegexMatch(r"^(.+)_(\d+)\.(conf)$", f):
|
||||||
s = re.search(r"^(.*)_(.*)\.(conf)$", f)
|
s = re.search(r"^(.+)_(\d+)\.(conf)$", f)
|
||||||
name = s.group(1)
|
name = s.group(1)
|
||||||
if name not in existingConfiguration:
|
if name not in existingConfiguration:
|
||||||
if name not in data['NonExistingConfigurations'].keys():
|
if name not in data['NonExistingConfigurations'].keys():
|
||||||
|
|
|
||||||
|
|
@ -903,8 +903,8 @@ class WireguardConfiguration:
|
||||||
files.sort(key=lambda x: x[1], reverse=True)
|
files.sort(key=lambda x: x[1], reverse=True)
|
||||||
|
|
||||||
for f, ct in files:
|
for f, ct in files:
|
||||||
if RegexMatch(f"^({self.Name})_(.*)\\.(conf)$", f):
|
if RegexMatch(f"^({self.Name})_(\d+)\\.(conf)$", f):
|
||||||
s = re.search(f"^({self.Name})_(.*)\\.(conf)$", f)
|
s = re.search(f"^({self.Name})_(\d+)\\.(conf)$", f)
|
||||||
date = s.group(2)
|
date = s.group(2)
|
||||||
d = {
|
d = {
|
||||||
"filename": f,
|
"filename": f,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue