Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when previewing an ascii file whose mimetype is not detected #1809

Closed
santilin opened this issue Jul 22, 2022 · 6 comments
Closed

Bug when previewing an ascii file whose mimetype is not detected #1809

santilin opened this issue Jul 22, 2022 · 6 comments

Comments

@santilin
Copy link

This is to report a bug in the code.

On fileinput.js, line 448 there is the getMimeType() function which has as its firs parameter signature.

This function is called on line 5788 with the hex variable as first parameter, but hex is not defined.

The problem arises when the plugins must show a preview of an ASCII file whose mime type is not detected, like a composer.lck file. In this case, an error is logged to the console signature not defined and the file is not shown in the preview window.

@SolidGlenn
Copy link

I have the exact same issue with a png image.

filetype is loaded with cdn in the order the documentation states.

<script defer src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/buffer.min.js" type="text/javascript"></script>
            <script defer src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/filetype.min.js" type="text/javascript"></script>
            <script defer src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/sortable.min.js" type="text/javascript"></script>
            <script defer src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/fileinput.min.js"></script>

The error msg:
Uncaught (in promise) ReferenceError: INT32_BE is not defined
at n (filetype.min.js:11:14534)
at FileTypeParser.parseTokenizer (filetype.min.js:11:14631)

also, when dropping images/files into the container, the console spams size properties

@kartik-v
Copy link
Owner

This is to report a bug in the code.

On fileinput.js, line 448 there is the getMimeType() function which has as its firs parameter signature.

This function is called on line 5788 with the hex variable as first parameter, but hex is not defined.

Do not think this is the issue for your use case. The hex variable is defined properly on line 5856 later and is used by the other functions/methods inside reader,onload callback.

Need to verify your issue. Can you share details or a JS FIDDLE to reproduce your issue?

@EnzoRimapa
Copy link

https://jsfiddle.net/vejb5suz/
example.txt

in jsfiddle nothing comes out but it does not load the preview of the file but locally this is the error that marks
image

@jmper
Copy link

jmper commented Oct 12, 2022

Still there is an error in getMimeType().
When trying to upload a .DS2 file (Olympus voice recording), I get an error "Uncaught (in promise) TypeError: signature is undefined" in getMimeType() (line 490 of fileinput.js)
This is very easy to reproduce: download sample DS2 file from https://idictate.com.au/2018/06/download-sample-dss-pro-ds2-audio-files-from-here/ and try to upload it.

@kartik-v
Copy link
Owner

Get the updated release from this repo and retry.

@kajal452
Copy link

is that issue is solved for png,svg image ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants