Well, Nx2 did exactly that :) But in Nx3 times changes :D :D https://github.com/sonatype/nexus-public/blob/nexus-2.x/components/nexus-core/src/main/java/org/sonatype/nexus/mime/DefaultMimeSupport.java#L158-L172
T On Tue, Sep 27, 2022 at 11:57 AM Nick Burch <[email protected]> wrote: > On Tue, 27 Sep 2022, Tamás Cservenák wrote: > > See this class, IMO it does exactly what you want: > > > https://github.com/sonatype/nexus-public/blob/main/components/nexus-mime/src/main/java/org/sonatype/nexus/mime/internal/DefaultMimeSupport.java#L138 > > > > Is able to detect several ("unravel" aliases and hierarchy) mime types by > > content or by filename. > > Looks pretty good! > > I think there might be a few more cases where you want to check the > supertype, and possibly some cases where you want to check the supertype > of the supertype! > > Other code you can pinch ideas from is in TikaCLI eg displaySupportedTypes > > https://github.com/apache/tika/blob/main/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java#L854 > and the parent type checking in compareFileMagic > > https://github.com/apache/tika/blob/main/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java#L943 > > Nick
