Permalink
Browse files

Sanitize layer names

  • Loading branch information...
Koen Bok
Koen Bok committed Dec 16, 2015
1 parent 893cb5d commit 864d7d5ec0505f60d69ab459327f7572f74ed9c3
@@ -192,7 +192,7 @@ window.__imported__["Android/layers.json.js"] = [
},
{
"id": 43,
"name": "Top Bar",
"name": "Top-Bar _",
"layerFrame": {
"x": 0,
"y": 0,
@@ -124,9 +124,11 @@ class exports.Importer
layerInfo.superLayer = superLayer
# Sanitize the layer names so mylayer.jpg gets converted to mylayer
for suffix in ["*", ".jpg", ".pdf"]
layerInfo.name = _.trimRight(layerInfo.name, suffix)
layerInfo.name = _.trimRight(layerInfo.name, suffix.toUpperCase())
for suffix in [".jpg", ".pdf"]
layerInfo.name = layerInfo.name.replace(suffix, "") if _.endsWith(layerInfo.name, suffix)
layerInfo.name = layerInfo.name.replace(suffix.toUpperCase(), "") if _.endsWith(layerInfo.name.toUpperCase(), suffix)
layerInfo.name = layerInfo.name.replace(/\W/g, "")
# We can create the layer here
layer = new LayerClass(layerInfo)
@@ -79,7 +79,7 @@
"Header"
]
},
"Top Bar": {
"TopBar": {
"frame": {
"x": 89,
"y": 199,
@@ -88,7 +88,7 @@
},
"subLayerNames": []
},
"Nav Bar": {
"NavBar": {
"frame": {
"x": 97,
"y": 117,
@@ -191,7 +191,7 @@
},
{
"id": 43,
"name": "Top Bar",
"name": "Top Bar.jpg",
"layerFrame": {
"x": 0,
"y": 0,
@@ -216,7 +216,7 @@
},
{
"id": 41,
"name": "Nav Bar",
"name": "Nav Bar*",
"layerFrame": {
"x": 0,
"y": 0,

0 comments on commit 864d7d5

Please sign in to comment.