NIFI-4718 Improved detection of FlowFile V3 in IdentityMimeType

This closes #7009

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Nissim Shiman 2023-02-10 19:46:02 +00:00 committed by exceptionfactory
parent 13d343d5ee
commit 5350b02923
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
4 changed files with 40 additions and 1 deletions

View File

@ -25,7 +25,7 @@
<mime-type type="application/flowfile-v3">
<_comment>NiFi FlowFile V3</_comment>
<magic>
<magic priority="70">
<match value="NiFiFF3" type="string" offset="0" />
</magic>
</mime-type>

View File

@ -72,7 +72,9 @@ public class TestIdentifyMimeType {
expectedMimeTypes.put("1.tar.gz", "application/gzip");
expectedMimeTypes.put("1.jar", "application/java-archive");
expectedMimeTypes.put("1.xml", "application/xml");
expectedMimeTypes.put("1.xhtml", "application/xhtml+xml");
expectedMimeTypes.put("flowfilev3", StandardFlowFileMediaType.VERSION_3.getMediaType());
expectedMimeTypes.put("flowfilev3WithXhtml", StandardFlowFileMediaType.VERSION_3.getMediaType());
expectedMimeTypes.put("flowfilev1.tar", StandardFlowFileMediaType.VERSION_1.getMediaType());
expectedMimeTypes.put("fake.csv", "text/csv");
expectedMimeTypes.put("2.custom", "text/plain");
@ -93,7 +95,9 @@ public class TestIdentifyMimeType {
expectedExtensions.put("1.tar.gz", ".gz");
expectedExtensions.put("1.jar", ".jar");
expectedExtensions.put("1.xml", ".xml");
expectedExtensions.put("1.xhtml", ".xhtml");
expectedExtensions.put("flowfilev3", "");
expectedExtensions.put("flowfilev3WithXhtml", "");
expectedExtensions.put("flowfilev1.tar", "");
expectedExtensions.put("fake.csv", ".csv");
expectedExtensions.put("2.custom", ".txt");
@ -185,7 +189,9 @@ public class TestIdentifyMimeType {
expectedMimeTypes.put("1.tar.gz", "application/octet-stream");
expectedMimeTypes.put("1.jar", "application/octet-stream");
expectedMimeTypes.put("1.xml", "text/plain");
expectedMimeTypes.put("1.xhtml", "text/plain");
expectedMimeTypes.put("flowfilev3", "application/octet-stream");
expectedMimeTypes.put("flowfilev3WithXhtml", "application/octet-stream");
expectedMimeTypes.put("flowfilev1.tar", "application/octet-stream");
expectedMimeTypes.put("fake.csv", "text/plain");
expectedMimeTypes.put("2.custom", "custom/abcd");
@ -206,7 +212,9 @@ public class TestIdentifyMimeType {
expectedExtensions.put("1.tar.gz", "");
expectedExtensions.put("1.jar", "");
expectedExtensions.put("1.xml", "");
expectedExtensions.put("1.xhtml", "");
expectedExtensions.put("flowfilev3", "");
expectedExtensions.put("flowfilev3WithXhtml", "");
expectedExtensions.put("flowfilev1.tar", "");
expectedExtensions.put("fake.csv", "");
expectedExtensions.put("2.custom", ".abcd");
@ -268,7 +276,9 @@ public class TestIdentifyMimeType {
expectedMimeTypes.put("1.tar.gz", "application/octet-stream");
expectedMimeTypes.put("1.jar", "application/octet-stream");
expectedMimeTypes.put("1.xml", "text/plain");
expectedMimeTypes.put("1.xhtml", "text/plain");
expectedMimeTypes.put("flowfilev3", "application/octet-stream");
expectedMimeTypes.put("flowfilev3WithXhtml", "application/octet-stream");
expectedMimeTypes.put("flowfilev1.tar", "application/octet-stream");
expectedMimeTypes.put("fake.csv", "text/plain");
expectedMimeTypes.put("2.custom", "text/plain");
@ -289,7 +299,9 @@ public class TestIdentifyMimeType {
expectedExtensions.put("1.tar.gz", "");
expectedExtensions.put("1.jar", "");
expectedExtensions.put("1.xml", "");
expectedExtensions.put("1.xhtml", "");
expectedExtensions.put("flowfilev3", "");
expectedExtensions.put("flowfilev3WithXhtml", "");
expectedExtensions.put("flowfilev1.tar", "");
expectedExtensions.put("fake.csv", "");
expectedExtensions.put("2.custom", "");

View File

@ -0,0 +1,27 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IdentifyMimeType Title</title>
</head>
<body>
IdentifyMimeType Body
</body>
</html>