Fix potential for invalid sorting of uploads
"date" and "size" might be undefined on both parameters (e.g. for folders, SD files). We have no guarantee that "a" will always have either defined, so make sure to test or a wrong sorting order might be the consequence. Fixes #2355
This commit is contained in:
1 parent
e980444f86
commit
5456f5a70a
1 file changed
+2
-2
@@ -99,13 +99,13 @@ $(function() {
|
||||
"upload": function(a, b) {
|
||||
// sorts descending
|
||||
if (b["date"] === undefined || a["date"] > b["date"]) return -1;
|
||||
if (a["date"] < b["date"]) return 1;
|
||||
if (a["date"] === undefined || a["date"] < b["date"]) return 1;
|
||||
return 0;
|
||||
},
|
||||
"size": function(a, b) {
|
||||
// sorts descending
|
||||
if (b["size"] === undefined || a["size"] > b["size"]) return -1;
|
||||
if (a["size"] < b["size"]) return 1;
|
||||
if (a["size"] === undefined || a["size"] < b["size"]) return 1;
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user