doctype2mime fix, influences metadata conversion between old metadata

and solr
pull/1/head
Michael Peter Christen 13 years ago
parent 7c31be1c80
commit a1b2c9a67d

@ -47,6 +47,7 @@ kml = application/vnd.google-earth.kml+xml
lha = application/x-lzh
lzh = application/x-lzh
m4v = video/x-m4v
md5 = text/plain
mf = application/octet-stream
mov = video/quicktime
mm = application/freemind

@ -118,16 +118,22 @@ public class Response {
}
public static String doctype2mime(String ext, char doctype) {
String mime = Classification.ext2mime(ext);
int p = mime.indexOf('/');
if (p < 0) return mime;
if (doctype == DT_TEXT) return "text" + mime.substring(p);
if (doctype == DT_PDFPS) return "application/pdf";
if (doctype == DT_HTML) return "text/html";
if (doctype == DT_DOC) return "application/msword";
if (doctype == DT_FLASH) return "application/x-shockwave-flash";
if (doctype == DT_SHARE) return "text/plain";
if (doctype == DT_BINARY) return "application/octet-stream";
String mime = Classification.ext2mime(ext);
int p = mime.indexOf('/');
if (p < 0) return mime;
if (doctype == DT_TEXT) return "text" + mime.substring(p);
if (doctype == DT_IMAGE) return "image" + mime.substring(p);
if (doctype == DT_AUDIO) return "audio" + mime.substring(p);
if (doctype == DT_MOVIE) return "video" + mime.substring(p);
return mime;
}
public static final int QUEUE_STATE_FRESH = 0;
public static final int QUEUE_STATE_PARSING = 1;
public static final int QUEUE_STATE_CONDENSING = 2;

@ -184,7 +184,7 @@ public class Classification {
}
public static String ext2mime(final String ext) {
return mimeTable.getProperty(ext, "application/" + ext);
return mimeTable.getProperty(ext, "application/" + (ext == null || ext.length() == 0 ? "octet-stream" : ext));
}
public static String ext2mime(final String ext, final String dfltMime) {

Loading…
Cancel
Save