Skip to content

Commit

Permalink
Fix zip mimetype on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed May 25, 2022
1 parent 628872e commit 2e31f58
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package prompto.expression;

import java.security.InvalidParameterException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.fasterxml.jackson.databind.JsonNode;

Expand Down Expand Up @@ -30,6 +33,7 @@
public class DocumentExpression implements IExpression {

private static Logger logger = new Logger();
private static Set<String> ZIP_MIME_TYPES = new HashSet<>(Arrays.asList("application/zip", "application/x-zip-compressed"));

IExpression source;

Expand Down Expand Up @@ -67,7 +71,7 @@ else if(value == NullValue.instance())
}

private DocumentValue documentFromBlob(Context context, BlobValue blob) {
if(!"application/zip".equals(blob.getMimeType()))
if(!ZIP_MIME_TYPES.contains(blob.getMimeType()))
throw new UnsupportedOperationException("Unsupported mime type: " + blob.getMimeType());
try {
Map<String, byte[]> parts = PromptoDocument.readParts(blob.getData());
Expand Down

0 comments on commit 2e31f58

Please sign in to comment.