mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
center: handle invalid version number
This commit is contained in:
1 file changed
+9
-1
@@ -13,6 +13,14 @@ function decrypt(encrypted: string) {
|
||||
).toString(crypto.enc.Utf8);
|
||||
}
|
||||
|
||||
const safeLt = (a: string, b: string) => {
|
||||
try {
|
||||
return lt(a, b);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
declare module 'hydrooj' {
|
||||
interface Collections {
|
||||
dataReport: any;
|
||||
@@ -64,7 +72,7 @@ class DataReportHandler extends Handler {
|
||||
dbVersion: payload.dbVersion,
|
||||
};
|
||||
if (old?.notification) setPayload.notification = '';
|
||||
if (old && lt(payload.version, old.version)) {
|
||||
if (old && safeLt(payload.version, old.version)) {
|
||||
await coll.updateOne(
|
||||
{ _id: installId },
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user