Skip to content

Commit

Permalink
#479 Remove restriction on Layer names (#480)
Browse files Browse the repository at this point in the history
* #479 Remove Layer Name restrictions

* #479 Remove console.log
  • Loading branch information
tariqksoliman authored Dec 20, 2023
1 parent 7bfaf79 commit 11bc3bd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
16 changes: 0 additions & 16 deletions API/Backend/Config/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,8 @@ const isValidLayerName = (name) => {
errs.push(
err("Found a layer with name: undefined", ["layers[layer].name"])
);
if (!validCSSName(name))
errs.push(
err(
`Layer: '${name}' must not be empty, a non-string, contain symbols or begin with numbers.`,
["layers[layer].name"]
)
);

return errs;

function validCSSName(name) {
if (name == null || typeof name !== "string") return false;

const match = name.match(/[_A-Z ]+[_A-Z0-9- ]+/gi);
if (match && match[0].length === name.length) return true;

return false;
}
};

const isValidUrl = (layer) => {
Expand Down
2 changes: 1 addition & 1 deletion src/essence/Basics/Layers_/LayerConstructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const constructVectorLayer = (
}

if (feature.properties.hasOwnProperty('style')) {
let className = layerObj.style.className
let className = layerObj.uuid
let layerName = layerObj.style.layerName
layerObj.style = Object.assign({}, layerObj.style)
layerObj.style = {
Expand Down

0 comments on commit 11bc3bd

Please sign in to comment.