forked from MapComplete/MapComplete
Add check: layer and theme ids must be lowercase and match [a-z_-]*
This commit is contained in:
parent
9916371122
commit
444f0bc47c
7 changed files with 27 additions and 15 deletions
|
@ -73,7 +73,13 @@ export default class LayerConfig extends WithContextLoader {
|
|||
|
||||
if (json.source.osmTags === undefined) {
|
||||
throw "Layer " + this.id + " does not define a osmTags in the source section - these should always be present, even for geojson layers (" + context + ")"
|
||||
}
|
||||
|
||||
if(json.id.toLowerCase() !== json.id){
|
||||
throw `${context}: The id of a layer should be lowercase: ${json.id}`
|
||||
}
|
||||
if(json.id.match(/[a-z0-9-_]/) == null){
|
||||
throw `${context}: The id of a layer should match [a-z0-9-_]*: ${json.id}`
|
||||
}
|
||||
|
||||
this.maxAgeOfCache = json.source.maxCacheAge ?? 24 * 60 * 60 * 30
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue