Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#479 Remove restriction on Layer names #480

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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