Skip to content

Commit 4528581

Browse files
authored
Merge pull request #4038 from chuckwagoncomputing/check-filename-length
Check filename length in CI
2 parents f3655ef + ae5b4bc commit 4528581

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

apps/messages_light/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
{"name":"boot_messages_light.boot.js","url":"messages_light.boot.js"},
1717
{"name":"messages_light.listener.js","url":"messages_light.listener.js"}
1818
],
19-
"data": [{"name":"messages_light.settings.json"},{"name":"messages_light.NewMessage.json"}],
19+
"data": [{"name":"messages_light.settings.json"},{"name":"messages_light.NewEvent.json"}],
2020
"screenshots": [{"url":"screenshot-notify.png"} ,{"url":"screenshot-long-text1.png"},{"url":"screenshot-long-text2.png"}, {"url":"screenshot-call.png"} ]
2121
}

bin/sanitycheck.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluat
171171
const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports'
172172
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","textinput","module","clkinfo","defaultconfig"]; // values allowed for "type" field - listed in README.md
173173
const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info
174+
const MAX_FILE_NAME_LENGTH = 28
174175
const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ];
175176
const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"];
176177
const INTERNAL_FILES_IN_APP_TYPE = { // list of app types and files they SHOULD provide...
@@ -287,6 +288,7 @@ apps.forEach((app,appIdx) => {
287288
app.storage.forEach((file) => {
288289
if (!file.name) ERROR(`App ${app.id} has a file with no name`, {file:metadataFile});
289290
if (isGlob(file.name)) ERROR(`App ${app.id} storage file ${file.name} contains wildcards`, {file:metadataFile});
291+
if (file.name.length > MAX_FILE_NAME_LENGTH) ERROR(`App ${app.id} storage file name ${file.name} is longer than ${MAX_FILE_NAME_LENGTH} characters}`, {file:metadataFile})
290292
let char = file.name.match(FORBIDDEN_FILE_NAME_CHARS)
291293
if (char) ERROR(`App ${app.id} storage file ${file.name} contains invalid character "${char[0]}"`, {file:metadataFile})
292294
if (fileNames.includes(file.name) && !file.supports) // assume that there aren't duplicates if 'supports' is set
@@ -410,6 +412,8 @@ apps.forEach((app,appIdx) => {
410412
ERROR(`App ${app.id} data file ${data.name} has both name and wildcard`, {file:metadataFile});
411413
if (isGlob(data.name))
412414
ERROR(`App ${app.id} data file name ${data.name} contains wildcards`, {file:metadataFile});
415+
if (data.name && data.name.length > MAX_FILE_NAME_LENGTH)
416+
ERROR(`App ${app.id} data file name ${data.name} is longer than ${MAX_FILE_NAME_LENGTH} characters}`, {file:metadataFile})
413417
if (data.wildcard) {
414418
if (!isGlob(data.wildcard))
415419
ERROR(`App ${app.id} data file wildcard ${data.wildcard} does not actually contains wildcard`, {file:metadataFile});

0 commit comments

Comments
 (0)