Skip to content

Commit

Permalink
fix invalid number bbox message
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Sep 26, 2023
1 parent 105ee41 commit 16324ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/fetch-dialog/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,13 @@ export default abstract class DynamicNoteFetchDialog extends NoteFetchDialog {
this.$bboxInput.setCustomValidity(lead+`must contain four comma-separated values`)
return false
}
const numbers=splitValue.map(Number)
for (const number of numbers) {
for (const number of splitValue) {
if (!isFinite(Number(number))) {
this.$bboxInput.setCustomValidity(lead+`values must be numbers, "${number}" is not a number`)
return false
}
}
const [west,south,east,north]=numbers
const [west,south,east,north]=splitValue.map(Number)
const area=(east-west)*(north-south)
if (area>maxBboxArea) {
this.$bboxInput.setCustomValidity(lead+`area must not be greater than ${maxBboxArea} square degrees, currently it's ${Math.round(area)}`)
Expand Down

0 comments on commit 16324ad

Please sign in to comment.