Closed Keltere closed 7 years ago
How about unzip
? :)
Ok that was a quite epicfail...
Really really thanks that worked but i still can't use for rar files... any suggestion?
You want to create rar? if so that is not supported yet.
Nope, just extract
I've already installed unrar and rar, but the file is not recognized as archive
It should work. Looking at this file, I remember I made it work.
https://github.com/qooob/authentic-theme/blob/master/extensions/file-manager/extract.cgi
If you reload with the circle button in File Manager controls, will you have it? Do you happen to have it in context menu?
Yes, i also tried to restart the service but nothing. It won't show up.
tried with 7zip and it's working fine, just rar file has problem
Talked to my friend with manjaro and he has the same problem, everything works except for rar files.
I would need to install Archlinux to test it. You most likely would have the same behavior in old themes.
Meanwhile I made a quick test on Debian by installing unrar
and here is what I got:
You need to make sure that you unrar
command is on the path. In case you open Command Shell in the theme and execute unrar
, what is the output?
Another possible solution is to manually set MIME Type Program
for rar
.
unrar
In the webmin command shell it's working. Also i check the MIME configuration for rar and it's everything ok.
Mime rar config vnd.rar.xml https://pastebin.com/xaB1e9Yf
Tried to refresh mime database with: update-mime-database /usr/share/mime
Still not working
As you can see on the screenshot, your system doesn't seem to detect MIME type for rar
files correctly. Try to rename a file manually typing .rar
at the end. Make sure there is no spaces or foreign characters in the string.
In case it's alright and it still doesn't work, go to Webmin/System/MIME Type Program and set it manually.
I can add more decompressors to the dependencies in the Virtualmin installer. unzip is already in there, and tar/gz are defaults on all Linux systems regardless, but I can probably add 7z and unrar. Are there any others?
Yes, you can see all of the dependencies that are checked in extract.cgi file. The other is for making zip
archives.
tar
needs to be checked explicitly as it has bzip
, xz
and other dependencies.
Maybe i have found out the problem
https://forum.manjaro.org/t/ark-16-08-1-1-regression-with-rar-files-cant-open-or-extract-them/9622
I will try today to find out some solution... anyway not a webmin problem. Thanks for the support and sorry to have bothered you for nothing.
That's okay.
Ok the problem is that they changed "application/x-rar" to "application/vnd.rar" I've tried to add this custom MIME to webmin but because of the dot i cannot do it.
MIME type doesn't need a dot.
Yes but shared-mime-info changed from x-rar to vnd.rar so i need to add support to it. I tried editing those 2 file adding vnd.rar but nothing changed. There are other files i need to edit?
/opt/webmin/authentic-theme/extensions/file-manager/extract.cgi /opt/webmin/filemin/extract.cg
Sorry to bother you.
Can you please let me know why I still cant unzip zip files with mime type: application-octet-stream. Every zip file i upload has this mime type. Why isnt automatically recognized as a zip? Is why my upload machine OS is windows?
You upload machine doesn't matter.
Please check System/MIME Type Programs.
Can you give me more info on this?
I can see that "application/zip" -> "unzip -l %s is enabled! Do I have to add application-octet-stream to unzip -l %s also? Is it safe?
This is system specific.
Did you make sure that you have unzip
installed? I have it displayed as application/zip
on Ubuntu.
Yup! I am using Debian 8 And it lists on apt list | grep unzip unzip/oldstable,oldstable,now 6.0-16+deb8u3 amd64 [installed]
And I think in Debian 8 there is no update-mime-database
update-mime-database /usr/share/mime -bash: update-mime-database: command not found
@alexbogias Could you follow. It seems related and easily fixable.
https://github.com/webmin/webmin/issues/702#issuecomment-378704623
@qooob You mean add application-octet-stream inside those if's ? Isn't application-octet-stream something more general?
Oh, man, yeah, I forgot it's the wrong type. Okay.
I'll try to reproduce it on my debug machines.
Is it all Debian 8 machines that affected by this bug or only particular one?
I just tried in 3x Debian 9 and 1x Debian 8 machine. Everything is application-octet-stream
Files which are created by virtualmin (backups) looks fine in Debian 9 tho
And files downloaded with wget by github comes like application-octet-stream also
How interesting. I will take a good look tomorrow.
Thank you for reporting.
Thank you for making my life easier ;)
Can you make a screenshot of MIME type module, as well. Just out of curiosity.
I'll do my best to reproduce it.
Do you exclude permission issue? Do you run SELinux?
Pemissions? I am on root: I just open console from virtualmin and unzip with unzip hjsplit.zip without a problem...
MIME type module:
SELinux? I am not sure what this does. Firewall? I just use virtualmin's and debian defaults: CSF, IPTables and Fail2Ban on Debian 9
Okay, I have exactly the same MIME types sets.
I was looking at MimeInfo.pm file and here is what I found:
=head1 METHODS
=item C<mimetype($file)>
If these methods are unsuccessful the file is read and the mimetype defaults
to 'text/plain' or to 'application/octet-stream' when the first ten chars
of the file match ascii control chars (white spaces excluded).
If the file doesn't exist or isn't readable C<undef> is returned.
=item C<default($file)>
This method decides whether a file is binary or plain text by looking at
the first few bytes in the file. Used to decide between "text/plain" and
"application/octet-stream" if all other methods have failed.
Looking further in the code I found:
no warnings; # warnings can be thrown when input not ascii
if ($] < 5.008 or ! utf8::valid($line)) {
use bytes; # avoid invalid utf8 chars
$line =~ s/\s//g; # \m, \n and \t are also control chars
return 'text/plain' unless $line =~ /[\x00-\x1F\x7F]/;
}
else {
# use perl to do something intelligent for ascii & utf8
return 'text/plain' unless $line =~ /[^[:print:]\s]/;
}
Now, open console and run:
file -b --mime your_file_name.extension
.. first for files created manually (those that fail, if I understood correctly) and then for those created by Virtualmin scripts (that work correctly).
What is the output? it should be something like:
application/gzip; charset=binary
What is the output of the command below if run it in browser's console?
get_server_data('charset')
Webmin: 1.850 Authentic-theme: 19
OS:Archlinux 4.13.3-1
I've installed 7z, unrar, zip etc... Everything is updated, i've also installed shared-mime-info and configured MIME on webmin but the extract button won't come out.
I've tried restarting the webmin service, reinstalling, clear cache, different browser (chrome, firefox, edge) nothing seems to work. I can't understand where is the problem.