Skip to content

Commit 93fcb03

Browse files
committed
Merge pull request #270 from pebble/bugfix/image-upload-constraints
Enforce PNG uploads for bitmap and pbi
2 parents e66c1ed + 3bdbb3d commit 93fcb03

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ide/api/resource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def show_resource(request, project_id, resource_id, variant):
235235
u'png': 'image/png',
236236
u'png-trans': 'image/png',
237237
u'bitmap': 'image/png',
238+
u'pbi': 'image/png',
238239
u'font': 'application/octet-stream',
239240
u'raw': 'application/octet-stream'
240241
}

ide/static/ide/js/resources.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ CloudPebble.Resources = (function() {
195195
if(files.length != 1) {
196196
return null;
197197
}
198-
if((kind == 'png' || kind == 'png-trans') && file.type != "image/png") {
198+
if(_.contains(['bitmap', 'png', 'png-trans', 'pbi'], kind) && file.type != "image/png") {
199199
throw (gettext("You must upload a PNG image."));
200200
}
201201
return file;
@@ -528,10 +528,10 @@ CloudPebble.Resources = (function() {
528528
case 'bitmap':
529529
case 'png':
530530
case 'png-trans':
531+
case 'pbi':
531532
template_name = 'image';
532533
break;
533534
case 'raw':
534-
case 'pbi':
535535
case 'font':
536536
template_name = 'raw';
537537
break;
@@ -964,7 +964,7 @@ CloudPebble.Resources = (function() {
964964
return names;
965965
},
966966
GetBitmaps: function() {
967-
return _.filter(project_resources, function(item) { return /^png/.test(item.kind); });
967+
return _.filter(project_resources, function(item) { return /^(png|pbi|bitmap)/.test(item.kind); });
968968
},
969969
GetFonts: function() {
970970
return _.where(project_resources, {kind: 'font'});

0 commit comments

Comments
 (0)