@@ -266,8 +266,6 @@ function ProjectController($scope, $http, $resource, $filter) {
266
266
return false ;
267
267
} ;
268
268
269
- var noTransform = function ( data ) { return data ; } ;
270
-
271
269
$scope . select = function ( i ) {
272
270
$scope . save ( function ( ) {
273
271
_select ( i )
@@ -284,16 +282,24 @@ function ProjectController($scope, $http, $resource, $filter) {
284
282
} ) ;
285
283
}
286
284
285
+ var noJsonTransform = function ( data ) { return data ; } ;
286
+
287
287
var _select = function ( i ) {
288
288
$scope . currentIndex = i ;
289
289
290
290
url = '//' + $scope . config . BLISS_USER_CONTENT_HOST +
291
291
document . location . pathname + 'getfile/' +
292
292
encodeURI ( $scope . currentFilename ( ) ) ;
293
- $http . get ( url , { transformResponse : noTransform } )
293
+ $http . get ( url , { transformResponse : noJsonTransform } )
294
294
. success ( function ( data , status , headers , config ) {
295
295
// e.g. 'text/html; charset=UTF-8'
296
296
var mime_type = headers ( 'Content-Type' ) ;
297
+ // Workaround missing HTTP response headers for CORS requests
298
+ // See https://github.com/angular/angular.js/issues/1468
299
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=608735
300
+ if ( ! mime_type ) {
301
+ mime_type = 'application/octet-stream' ;
302
+ }
297
303
// strip '; charset=...'
298
304
mime_type = mime_type . replace ( / ? ; .* / , '' ) ;
299
305
if ( / ^ i m a g e \/ / . test ( mime_type ) ) {
0 commit comments