Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Development server incorrectly assumes SVG images are web fonts. #107

Open
bradgreens opened this issue Apr 18, 2013 · 0 comments
Open

Development server incorrectly assumes SVG images are web fonts. #107

bradgreens opened this issue Apr 18, 2013 · 0 comments

Comments

@bradgreens
Copy link

The following function assumes my SVG image file is a webfont before it is served by the development server. Took a couple hours to debug. The SVG file needs to be investigated further in the test to determine if it's actually a font or an image.

Task_ContentType.prototype.duty = function(framework,callback){
var self = this;

  framework.files.forEach(function(cF){
  cF.contentType = (self.contentTypes[cF.getFileExtension()]) ? self.contentTypes[cF.getFileExtension()] :  'text/plain';

   switch (true) {

     // This isWebfont() test will assume all SVG files are web fonts!
     // This detection is incorrect and prevents all SVG files from being served on the development server

     case (cF.isWebfont()):
       cF.requestPath = 'theme/'+cF.getBaseName()+cF.getFileExtension();
       break;

     case (cF.isImage()):
       cF.requestPath = 'theme/images/'+cF.getBaseName()+cF.getFileExtension();
       break;
     case (cF.isStylesheet()):
       cF.requestPath = 'theme/'+cF.getBaseName()+cF.getFileExtension();
       cF.contentType = "text/css; charset=utf-8";
       break;
     case (cF.isHTML()):
       cF.requestPath = cF.getBaseName()+cF.getFileExtension();
       break;
     default:
       cF.requestPath = cF.getBaseName()+cF.getFileExtension();
       break;
   }
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant