From 163b780f0b31ecfaa2a188373c464fca6fab12e4 Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Sun, 24 Sep 2023 11:38:23 +0000 Subject: [PATCH] Improve api version code validation (#1303) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Describe what your pull request does and which issue you’re targeting This PR improves the validation of the version code received from the api. Closes #1287

- [x] I carefully read the [contribution guidelines](https://codeberg.org/GitNex/GitNex/src/branch/main/CONTRIBUTING.md). - [x] I'm following the code standards as defined [here](https://codeberg.org/gitnex/GitNex/wiki/Code-Standards). - [x] By submitting this pull request, I permit GitNex to license my work under the [GNU General Public License v3](https://codeberg.org/GitNex/GitNex/src/branch/main/LICENSE). Co-authored-by: DrMaxNix Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1303 Reviewed-by: M M Arif Co-authored-by: DrMaxNix Co-committed-by: DrMaxNix --- app/src/main/java/org/mian/gitnex/helpers/Version.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/mian/gitnex/helpers/Version.java b/app/src/main/java/org/mian/gitnex/helpers/Version.java index 1ec83d61..6c813fdb 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/Version.java +++ b/app/src/main/java/org/mian/gitnex/helpers/Version.java @@ -36,7 +36,7 @@ public class Version { return false; } final Pattern patternValid = - Pattern.compile("^[v,V]?(\\d+)+(\\.(\\d+))*([_,\\-,+][\\w,\\d,_,\\-,+]*)?$"); + Pattern.compile("^[vV]?(\\d+)+(\\.(\\d+))*([_\\-+][\\w\\-+\\.]*)?$"); return value.equals("main") || patternValid.matcher(value).find(); }