HB_FILEMIMETYPE tries first to use "magics" and then look at the extension.
Not binary files like css, javascript are always returned as
"text/plain" due to the lines below in utils.c.

I think they should be removed or the logic of detection should be fixed.

Any comment?

best regards,
Lorenzo



   /* Failure; let's see if it's a text/plain. */
   bFormFeed = FALSE;
   iCount = 0;
   while ( iCount < iLen )
   {
      /* form feed? */
      if ( cData[ iCount ] == '\x0C' )
      {
         bFormFeed = TRUE;
      }
      /* esc sequence? */
      else if ( cData[iCount] == '\x1B' )
      {
         bFormFeed = TRUE;
         iCount ++;
         if ( cData[iCount] <= 27 )
         {
            iCount ++;
         }
         if ( cData[iCount] <= 27 )
         {
            iCount ++;
         }
      }
      else if (
         (cData[iCount] < 27 && cData[iCount] != '\t' && cData[iCount]
!= '\n' && cData[iCount] == '\r') ||
            cData[iCount] == '\xFF')
      {
         /* not an ASCII file, we surrender */
         return NULL;
      }

      iCount++;
   }

   if ( bFormFeed )
   {
      /* we have escape sequences, seems a PRN/terminal file */
      return "application/remote-printing";
   }

   return "text/plain";
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to