View Issue Details

IDProjectCategoryView StatusLast Update
15237Bug reports[All Projects] Survey designpublic2019-09-18 16:18
ReporterFreshLemonUser Assigned ToDenisChenu  
PrioritynoneSeverityfeature 
Status closedResolutionfixed 
Product Version3.17.x 
Target VersionFixed in Version3.17.x 
Summary15237: I can´t Upload 3gpp, amr, aac audio files using File Upload Question
Description

Hello Dear Limesurvey Team, i would like to receive some help with the Limesurvey configuration, i need to upload 3gpp, amr, aac files using a File Upload Question but we coudn´t, each file shows a different error.

i´ve already adjust the configuration on the question:

Question: Upload Files
Type: File upload
Relevance equation: 1
Maximum file size allowed (in KB): 50240
Allowed file types: 3gpp, aac, mpeg, wav, amr, mp4, mp3

aac case: 500: Error interno del servidor - Unable to check mime type of files, please activate FileInfo on server.
3gpp case: Sorry, file type application/octet-stream (extension : bin) is not allowed!
amr case: Sorry, file type application/octet-stream (extension : bin) is not allowed!

I already have enable the fileinfo extensión on php 7.2

fileinfo
fileinfo support enabled
version 1.0.5
libmagic 531

I´ll really appreciate your help i´ve already posted it on the IRC chat and the suggested me to publish it as a bug. Please can you point me on the rigth direction?

Thanks in advanced.

TagsNo tags attached.
Complete LimeSurvey version number (& build)Version 3.17.15+190903
I will donate to the project if issue is resolvedNo
Browser 69.0 Firefox Release September 3, 2019
Database & DB-Versionmariadb-5.5.60-1.el7_5.x86_64
Server OS (if known) Operating System: CentOS Linux 7 (Core) - Architecture: x86-64
Webserver software & version (if known)Server version: Apache/2.4.6 (CentOS) Server built: Jul 29 2019 17:18:49
PHP VersionPHP 7.2.22 (cli) (built: Aug 28 2019 09:29:33) ( NTS )

Activities

ollehar

ollehar

2019-09-05 16:57

administrator   ~53477

Missing mime types in the code base?

FreshLemonUser

FreshLemonUser

2019-09-05 17:26

reporter   ~53478

ollehar: Sorry, what should i do?

DenisChenu

DenisChenu

2019-09-05 18:09

developer   ~53479

The 500 error are only here with debug>1 and for super-admin.
Can you upload jpg file ?

The file list is here : https://github.com/LimeSurvey/LimeSurvey/blob/e749eddfea5cebf86a72e408d1c4dafdaf7fd5ae/framework/utils/fileExtensions.php#L14
Maybe we need to allow update in config.php ?

DenisChenu

DenisChenu

2019-09-05 18:10

developer   ~53480

PS : code to get mime : https://github.com/LimeSurvey/LimeSurvey/blob/e749eddfea5cebf86a72e408d1c4dafdaf7fd5ae/framework/utils/CFileHelper.php#L328
Used by LimeSurvey : https://github.com/LimeSurvey/LimeSurvey/blob/e749eddfea5cebf86a72e408d1c4dafdaf7fd5ae/application/controllers/UploaderController.php#L179

Maybe … potential big issue , quick solution is to allow disable mime type checking …

DenisChenu

DenisChenu

2019-09-05 18:19

developer   ~53481

Can you upload here 3 light file aac, 3gp and amr ?

And can you check locally on your server with file --mime-type ?

FreshLemonUser

FreshLemonUser

2019-09-05 20:07

reporter   ~53484

Hello sear DenisChenu: I´ll attaching sample Audio Files,

'debug'=>1,

Uploading an ACC file:

https://pastebin.com/FJY4SyFM

Uploading a m4a file:

https://pastebin.com/nFXRrvaz

Uploading an AMR file:

  • Sorry, file type application/octet-stream (extension : bin) is not allowed!*

Uploading 3gp file:

  • Sorry, file type application/octet-stream (extension : bin) is not allowed! *

Uploading 3gpp file

  • Sorry, file type application/octet-stream (extension : bin) is not allowed!*

In https://github.com/LimeSurvey/LimeSurvey/blob/e749eddfea5cebf86a72e408d1c4dafdaf7fd5ae/framework/utils/fileExtensions.php#L14 we can find aac and 3gp

'audio/x-aac'=>'aac',
'video/3gpp'=>'3gp',

mime types:

1.amr 2.aac 3.m4a 4.3gp 5.3gpp

file 1.amr --mime-type

1.amr: application/octet-stream

#file 2.aac --mime-type
2.aac: audio/x-hx-aac-adts

#file 3.m4a --mime-type
3.m4a: audio/mp4

file 4.3gp --mime-type

4.3gp: application/octet-stream

file 5.3gpp --mime-type

5.3gpp: video/3gpp

Thanks in advanced.

Best regards a FreshLemonUser



1.amr (717,446 bytes)
2.aac (327,825 bytes)
3.m4a (55,548 bytes)
4.3gp (96,070 bytes)
5.3gpp (1,724,878 bytes)
DenisChenu

DenisChenu

2019-09-06 07:39

developer   ~53485

2.aac: audio/x-hx-aac-adts are not inside fileExtensions.php

But the most strange are 5.3gpp: video/3gpp : it know by your server, in fileExtensions …

Send a png or jpg file work or not ? And can you check an .ico file (maybe this one) to upload (and to file --mimetype)

About fileInfo : can you send phpinfo as html file ?

DenisChenu

DenisChenu

2019-09-06 08:21

developer   ~53486

OK,

Your fileinfo is OK …
Error on check .ico file : https://github.com/LimeSurvey/LimeSurvey/commit/ab4bd5180958fd31f2dc2408ec0fffe7dc952b1c

ollehar

ollehar

2019-09-06 10:22

administrator   ~53487

quick solution is to allow disable mime type checking …

Too insecure IMO.

ollehar

ollehar

2019-09-06 10:25

administrator   ~53488

Looks like this is an issue for the Yii team? They need to add the missing mime types in their file.

DenisChenu

DenisChenu

2019-09-06 10:48

developer   ~53493

@ollehar : no

  1. We can use CFileHelper::getExtensionByMimeType params to use the php file from config
  2. We can use $_ENV MAGIC for mime_type file

Alternate resolution :
1 : we must update call of getExtensionByMimeType : not diffcult.

  1. Tell user to use setenv('MAGIC=isgreatmagicfile'); in manual

It's the reason i make a pull request and not a commit.

DenisChenu

DenisChenu

2019-09-06 10:51

developer   ~53495

for the alternative fileInfo file
https://framabin.org/p/?04d0ac3af1a2933f#Uu3KTx+wWvCH5+6fdy4KG8iAAhVROeq0uWIyJ4z7Nco=

@FreshLemonUser
Can you, check with https://github.com/LimeSurvey/LimeSurvey/pull/1318#partial-pull-merging

And

        'magic_database' => '/usr/share/misc/magic.mgc',
        'magic_file' => '/whereyouputthisfile/fileExtensionsBis.php',

'/usr/share/misc/magic.mgc', ius for fedora, then i think can be same in CentOs

jelo

jelo

2019-09-06 11:13

partner   ~53498

Correct, CentOS7 "file-libs" uses /usr/share/misc/magic.mgc as well.

For reference the current package of "file-libs".
https://centos.pkgs.org/7/centos-x86_64/file-libs-5.11-35.el7.x86_64.rpm.html

ollehar

ollehar

2019-09-06 11:14

administrator   ~53499

How is the OS magic file relevant if Yii has a hardcoded list anyway?

jelo

jelo

2019-09-06 11:43

partner   ~53500

@ollehar: I had the impression that Denis wants to implement a override via this pullrequest.
https://github.com/LimeSurvey/LimeSurvey/pull/1318/files

DenisChenu

DenisChenu

2019-09-06 11:57

developer   ~53501

How is the OS magic file relevant if Yii has a hardcoded list anyway?

PHP7.3 (on Fedora) using PHP7 mimetype file VS /usr/share/misc/magic.mgc (on same fedora)

amr file
application/octet-stream VS audio/amr
aac file : OK for both
m4a : ok for both
3gp:
application/octet-stream VS audio/amr
3gpp OK for both

DenisChenu

DenisChenu

2019-09-06 12:07

developer   ~53502

@jelo : need 2 override:

  1. MAGIC database for https://www.php.net/manual/en/function.finfo-open.php
  2. fileinfo array (mime type to extension) for https://github.com/LimeSurvey/LimeSurvey/blob/7aaebcbbfc33f9cb532e695f358b416a53fb0a1e/framework/utils/CFileHelper.php#L301

Not the same for both

DenisChenu

DenisChenu

2019-09-06 12:38

developer   ~53503

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=29098

DenisChenu

DenisChenu

2019-09-06 14:50

developer   ~53504

OK,

Now need updating manual …

DenisChenu

DenisChenu

2019-09-06 15:08

developer   ~53505

Manual updated
https://manual.limesurvey.org/QS:Allowed_filetypes
https://manual.limesurvey.org/Optional_settings#Upload_files

@cdorin : unsure of the best place for config ? Good page, but maybe didn't need a specific title ?

lime_release_bot

lime_release_bot

2019-09-18 16:18

developer   ~53638

Fixed in Release 3.17.17+190918

Related Changesets

LimeSurvey: master ab4bd518

2019-09-06 08:19:33

DenisChenu

Details Diff
Dev: Throw error about MimeType only without FileInfo
Dev: related issue 15237
Affected Issues
15237
mod - application/controllers/UploaderController.php Diff File

LimeSurvey: master ebd6eb63

2019-09-06 12:38:38

DenisChenu


Committer: LouisGac Details Diff
Fixed issue 15237: Upload 3gpp, amr, aac audio files using File Upload Question (#1318)

Fixed issue 15237: Upload 3gpp, amr, aac audio files using File Upload Question
Dev: allowing to set mime database from config
Dev: allowing to set magic file (extension by magic type)
Dev: review file to check : ico can have image/vnd.microsoft.icon mime type (not in system.utils.fileExtensions)
Dev: use config['magic_database'] only if needed
Dev: more comment
Dev: Yii code to LS code (and make CodeFactor and @ollehar happy)
Dev: fix return type (from Yii)
Dev: some other function call fix,
Dev: log as error when can find extension for mime type
Affected Issues
15237
mod - application/config/config-defaults.php Diff File
mod - application/controllers/UploaderController.php Diff File
add - application/core/LSFileHelper.php Diff File

Issue History

Date Modified Username Field Change
2019-09-05 16:37 FreshLemonUser New Issue
2019-09-05 16:57 ollehar Note Added: 53477
2019-09-05 17:26 FreshLemonUser Note Added: 53478
2019-09-05 18:09 DenisChenu Note Added: 53479
2019-09-05 18:10 DenisChenu Note Added: 53480
2019-09-05 18:19 DenisChenu Assigned To => DenisChenu
2019-09-05 18:19 DenisChenu Status new => feedback
2019-09-05 18:19 DenisChenu Note Added: 53481
2019-09-05 20:07 FreshLemonUser File Added: 1.amr
2019-09-05 20:07 FreshLemonUser File Added: 2.aac
2019-09-05 20:07 FreshLemonUser File Added: 3.m4a
2019-09-05 20:07 FreshLemonUser File Added: 4.3gp
2019-09-05 20:07 FreshLemonUser File Added: 5.3gpp
2019-09-05 20:07 FreshLemonUser Note Added: 53484
2019-09-05 20:07 FreshLemonUser Status feedback => assigned
2019-09-06 07:39 DenisChenu Note Added: 53485
2019-09-06 08:21 DenisChenu Changeset attached => LimeSurvey master ab4bd518
2019-09-06 08:21 DenisChenu Note Added: 53486
2019-09-06 10:22 ollehar Note Added: 53487
2019-09-06 10:25 ollehar Note Added: 53488
2019-09-06 10:48 DenisChenu Note Added: 53493
2019-09-06 10:51 DenisChenu Note Added: 53495
2019-09-06 11:13 jelo Note Added: 53498
2019-09-06 11:14 ollehar Note Added: 53499
2019-09-06 11:43 jelo Note Added: 53500
2019-09-06 11:57 DenisChenu Note Added: 53501
2019-09-06 12:07 DenisChenu Note Added: 53502
2019-09-06 12:38 LouisGac Changeset attached => LimeSurvey master ebd6eb63
2019-09-06 12:38 DenisChenu Note Added: 53503
2019-09-06 12:38 DenisChenu Resolution open => fixed
2019-09-06 14:50 DenisChenu Note Added: 53504
2019-09-06 15:08 DenisChenu Status assigned => resolved
2019-09-06 15:08 DenisChenu Fixed in Version => 3.17.x
2019-09-06 15:08 DenisChenu Note Added: 53505
2019-09-18 16:18 lime_release_bot Note Added: 53638
2019-09-18 16:18 lime_release_bot Status resolved => closed