Skip to content

Commit

Permalink
Convert ANDROID_VERSION to string
Browse files Browse the repository at this point in the history
  • Loading branch information
agrueneberg committed Jun 28, 2019
1 parent 8f8385c commit 7db4518
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion validate_doc_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ function(newDoc, oldDoc, userCtx) {
throw({"unauthorized": "You may only post reports with reporter, _admin or _writer role "});
}

// Problem: Build.VERSION.RELEASE - "Do not assume that its value has any
// particular structure or that values of RELEASE from different releases
// can be somehow ordered."
// (https://developer.android.com/reference/android/os/Build.VERSION.html#RELEASE)
if(newDoc.ANDROID_VERSION) {
var androidVersionParts = newDoc.ANDROID_VERSION.split('.');
var androidVersionParts = newDoc.ANDROID_VERSION.toString().split('.');
if (androidVersionParts.length > 1 && androidVersionParts[0] < MIN_ANDROID_MAJOR) {
throw({"forbidden": "Reports from Android version less than " + MIN_ANDROID_MAJOR + " are no longer allowed."});
}
Expand Down

0 comments on commit 7db4518

Please sign in to comment.