Hello,
There’s a bug in this function, and I have a feature request:
Just like what I’ve seen in some storage readers, if I pass the file name as string to the DetectFileFormat AND the file is Read-Only, UnauthorizedAccessException will occur!
IMO, you must revise the whole code for (string) overloads and remove the File.Attrib check or whatever you’re doing there!
DetectFileFormat is a read operation by nature, it does not need to alter the passed file, so this behavior is extremely wrong.
- As I’ve learned I’d never pass any file as string to any function of the SDK, instead I use a FileStream and pass the stream to Aspose, so although this is a preventing bug, I’m OK as long as I use FileStream, but should be fixed.
If you need sample project + sample file, it’s attached, just run to reproduce the error!
WindowsApplication6.zip (3.8 MB)
** I have a suggestion which is mostly my case:
Please kindly add Olm and Tgz to the FileFormatType enum.
So, DetectFileFormat will support detecting these 2 formats, which you already support in other sections!
Please inform me about the possibility of this addition?
Please also add this:
I have saved a simple html page via IE11 as mhtml (attached)
It’s being reported as Eml by DetectFileFormat.
Actually, mht is just an eml file, I’d like to know how it will be considered as mht, just in case of extension?
If so, it’s being reported incorrectly, since it has mht or mhtml extension.
InterNIC.zip (14.0 KB)
@australian.dev.nerds
We have logged this problem in our issue tracking system. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
@australian.dev.nerds
The ticket ID for your case is EMAILNET-40715.
1 Like
Hello,
If you save a web page with IE, the 1st line of output mhtml file will be:
From: “Saved by Internet Explorer 11”
You may save one page from IE yourself and test it against DetectFileFormat, it’s detected as EML, and not MHT, not major, just wanted to draw some attention to it, fire and forget
@australian.dev.nerds,
This is a rather confusing case, for example on my side both IE and Chrome write From: <Saved by Blink>
in output. Seems it depends on the browser engine. So, we can’t rely on things that can change quite often.
The fact is that mht and eml are exactly the same internally. So probably the only parameter to rely on is the file extension.
We will take this into account in our implementation of FileFormatUtils.
1 Like
Hello,
Blink is the underlying Google Chrome engine which of course exists in Chrome, but IE, if in an updated Win10/11 means that your IE is deprecated into the MS Edge Chromium and is using the same engine!
Otherwise should be IE 11/10 etc
A low-level browser engine is not changing quite often
So this pattern can be helpful:
From: <Saved by blah>
From: “Saved by blah”
Just for the record
oh, and for users like me whom will pass it as a stream, no file name to deal with
@australian.dev.nerds,
Noted. Thanks for sharing your thoughts.