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

File type not allowed #1109

Closed
alexseys opened this issue Nov 20, 2018 · 11 comments
Closed

File type not allowed #1109

alexseys opened this issue Nov 20, 2018 · 11 comments
Labels

Comments

@alexseys
Copy link

sysPass Version
3.0-rc4 (300.18111902)

Describe the question
Importing csv is not working
from file:
cat Downloads/testimport.csv
"Test Account15";"Test Customer19";"Test Category";"Test URL";"Testuser12";"TestPassword1";"TestNotes"
"Test Account3";"Test Customer2";"Test Category1";"Test URL2";"Testuser22";"TestPassword2";"TestNotes3"
"Test Account4";"Test Customer22";"Test Category2";"Test URL3";"Testuser32";"TestPassword3";"TestNotes4"
"Test Account2";"Test Customer23";"Test Category2";"Test URL4";"Testuser42";"TestPassword4";"TestNotes5"
"Test Account11";"Test Customer42";"Test Category2";"Test URL";"Testuser3";"TestPassword1";"TestNotes"
"Test Account32";"Test Customer25";"Test Category2";"Test URL2";"Testuser23";"TestPassword2";"TestNotes3"
"Test Account42";"Test Customer52";"Test Category6";"Test URL3";"Testuser33";"TestPassword3";"TestNotes4"
"Test Account22";"Test Customer8";"Test Category7";"Test URL4";"Testuser43";"TestPassword4";"TestNotes5"
"Test Account13";"Test Customer9";"Test Category8";"Test URL";"Testuser4";"TestPassword1";"TestNotes"
"Test Account34";"Test Customer10";"Test Category9";"Test URL2";"Testuser24";"TestPassword2";"TestNotes3"
"Test Account44";"Test Custome11r";"Test Category20";"Test URL3";"Testuser34";"TestPassword3";"TestNotes4"
"Test Account24";"Test Customer12";"Test Category21";"Test URL4";"Testuser44";"TestPassword4";"TestNotes5"
Screenshots
If applicable, add screenshots to help explain your problem.
image

Platform (please complete the following information):

  • OS: Centos
  • OS: 7
  • Browser Firefox, Chrome, Safari

Additional context
syslog:
2018-11-20 20:20:14 [EXCEPTION] [N/A] File type not allowed
#0 /var/www/html/lib/SP/Services/Import/FileImport.php(67): SP\Services\Import\FileImport::checkFile(Array)
#1 /var/www/html/app/modules/web/Controllers/ConfigImportController.php(75): SP\Services\Import\FileImport::fromRequest('inFile', Object(SP\Http\Request))
#2 [internal function]: SP\Modules\Web\Controllers\ConfigImportController->importAction()
#3 /var/www/html/lib/SP/Bootstrap.php(228): call_user_func_array(Array, Array)
#4 [internal function]: SP\Bootstrap->SP{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#5 /var/www/html/vendor/klein/klein/src/Klein/Klein.php(886): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#6 /var/www/html/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#7 /var/www/html/lib/SP/Bootstrap.php(450): Klein\Klein->dispatch(Object(Klein\Request))
#8 /var/www/html/lib/Base.php(74): SP\Bootstrap::run(Object(DI\Container))
#9 /var/www/html/index.php(28): require('/var/www/html/l...')
#10 {main}
2018-11-20 20:20:14 [DEBUG] [SP\Providers\Log\FileLogHandler::updateEvent] exception;File type not allowed

@nuxsmin
Copy link
Owner

nuxsmin commented Nov 20, 2018

Hello, it seems that CentOS does not have the same mine type associated to CSV files. sysPass expects text/csv, so could you check out which is associated to CSV files within /etc/mime.types file?

Regards

@alexseys
Copy link
Author

Here is what I have:

cat /etc/mime.types | grep csv
text/csv csv

@alexseys
Copy link
Author

Just a note this is the same system i had syspass 3, on and import csv worked before updating to rc4.
Dont know if this helps

Thank you

@nuxsmin
Copy link
Owner

nuxsmin commented Nov 20, 2018

Hmm, really weird, because it's the expected file type indeed

@nuxsmin
Copy link
Owner

nuxsmin commented Nov 20, 2018

It could be detected as text/plain

@jinyiwoo
Copy link

I have the issue of "MIME type allowed application/vnd.ms-excel" When import accounts from .csv file. And i have tested this import in Windows client and RedHat Client.
sysPass version: 3.0-rc3 (300.18111901)
OS Version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.11
Browser: (Windows) Google Chrome 70.0.3538.102 / (RedHat) Firefox ESR 31.1.0

@jinyiwoo
Copy link

Below Error has been resolved:
"MIME type not allowed application/vnd.mes-excel"
Resolved method:
vi SP/Services/Import/ImportService.php
line 37: const ALLOWED_MIME = ['text/csv', 'application/xml', 'text/xml'];
modified: const ALLOWED_MIME = ['text/csv', 'application/xml', 'text/xml',' application/vnd.mes-excel'];
Restart httpd.
Then can import accounts from .csv file.

@nuxsmin
Copy link
Owner

nuxsmin commented Nov 25, 2018

@jinyiwoo thanks for the feedback!. I'll code this tweak into sysPass

Regards

nuxsmin added a commit that referenced this issue Nov 25, 2018
@nuxsmin
Copy link
Owner

nuxsmin commented Nov 25, 2018

Hello, some additional mime type have been added for importing CSV file. Please check it out from latest commits.

@alexseys
Copy link
Author

Hi,
Sorry should've reply earlier, I reinstalled on ubuntu 18 and do not have issue with file type.
Will see later if it works with centos
My place does not "require" any particular OS to be used.

Thank you.

@MagikEh
Copy link

MagikEh commented Jun 21, 2019

@nuxsmin I'd like to reopen this issue (#1109) as I'm having problems with importing CSVs on a Win10 Pro machine with Chrome 75.0.3770.100 (Official Build) (32-bit). Attempting to attach the .csv when in a red box at the top of the screen I get the error:

MIME type not supported
application/vnd.ms-excel

Looking deeper into the source it would appear that in ImportService.php line 41.. there is not an entry included for the mime type application/vnd.ms-excel. (however, there is an entry for application/vnc.mes-excel) According to Wikipedia This is a proper mime-type for excel documents.. I'm not sure why It's being called an excel sheet when it's clearly a .csv document.. Might be something on my machine that is telling Chrome this.

Please add this to your list of Allowed Mime types:

application/vnd.ms-excel

Doing so in my local container has fixed my issue.

Also, I'd like to note that I cannot seem to import data from a .xlsx file Mime type not supported ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") Not sure what's up with that, but I now have .csv files working. Here is a sample of a file that's throwing the error for me. Pws.xlsx (created using MS Excel for Office 365 MSO (16.0.11328.20314) 64 bit)

Thanks for the great app!

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

No branches or pull requests

4 participants