Files in hidden directories do not have their MIME types detected #26133

Closed
ikogan opened this Issue Sep 18, 2016 · 5 comments

Projects

None yet

2 participants

@ikogan
ikogan commented Sep 18, 2016

MIME types for files don't seem to be detected when the file is in a hidden directory.

Steps to reproduce

  1. Create external storage location of type "file". I made it in /var/www/test.
  2. Place an image file into the directory.
  3. Create a hidden directory, I made it in /var/www/test/.hidden.
  4. Place an image into the hidden directory.
  5. Navigate to the location in OwnCloud.

Expected behaviour

Both the image in the top level directory and the image in the hidden directory
show up as images with thumbnails generated.

Actual behaviour

The image in the top level directory shows up as an image and has a thumbnail. The image in the hidden directory shows up as an undetected file type (digging into the code, it's seen as an octet-stream).

Server configuration

Operating system:
Linux cloud.gaea.mythicnet.org 4.7.3-200.fc24.x86_64 #1 SMP Wed Sep 7 17:31:21 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Web server:
Name : httpd
Arch : x86_64
Epoch : 0
Version : 2.4.23
Release : 4.fc24
Repo : @System

Database:
Running on a separate machine in Docker: 5.5.5-10.1.14-MariaDB-1~trusty

PHP version:
Name : php
Arch : x86_64
Epoch : 0
Version : 5.6.25
Release : 1.fc24
Repo : @System

ownCloud version: (see ownCloud admin page)
Name : owncloud
Arch : noarch
Epoch : 0
Version : 9.1.0
Release : 1.1
Repo : @System

Updated from an older ownCloud or fresh install:
Fresh install

Where did you install ownCloud from:
The upstream OwnCloud repo.

Signing status (ownCloud 9.0 and above):
No errors have been found.

List of activated apps:
Enabled:

  • activity: 2.3.2
  • checksum: 2.0
  • comments: 0.3.0
  • contacts: 1.4.0.0
  • dav: 0.2.5
  • documents: 0.13.1
  • external: true
  • federatedfilesharing: 0.3.0
  • files: 1.5.1
  • files_external: 0.6.0
  • files_pdfviewer: 0.8.1
  • files_sharing: 0.10.0
  • files_texteditor: 2.1
  • files_trashbin: 0.9.0
  • files_videoplayer: 0.9.8
  • firstrunwizard: 1.1
  • galleryplus: 15.1.1
  • notifications: 0.3.0
  • ownbackup: 0.3.8
  • provisioning_api: 0.5.0
  • systemtags: 0.3.0
  • tasks: 0.9.3
  • templateeditor: 0.1
  • updatenotification: 0.2.1
  • user_ldap: 0.9.0
    Disabled:
  • calendar
  • encryption
  • federation
  • files_antivirus
  • files_mv
  • files_versions
  • gallery
  • user_external

The content of config/config.php:

{
    "system": {
        "updatechecker": false,
        "instanceid": "ocp49oyky72e",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "my.domain.org"
        ],
        "datadirectory": "\/var\/www\/html\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/my.domain.org",
        "dbtype": "mysql",
        "version": "9.1.0.15",
        "dbname": "owncloud",
        "dbhost": "database.internal.private",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "US\/Eastern",
        "installed": true,
        "ldapIgnoreNamingRules": false,
        "token_auth_enforced": true,
        "skeletondirectory": "",
        "log_type": "syslog",
        "appstore.experimental.enabled": true,
        "blacklisted_files": [
            ".htaccess",
            "authorized_keys",
            ".c9",
            ".cache",
            ".ccache",
            ".zfs",
            ".npm",
            ".grails",
            ".m2",
            ".pip",
            ".thumbnails",
            ".wine-pipelight"
        ],
        "filesystem_check_changes": 1,
        "preview_libreoffice_path": "\/bin\/soffice",
        "asset-pipeline.enabled": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "preview_max_scale_factor": 1,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "filelocking.enabled": false,
        "loglevel": 1
    },
    "apps": {
        "activity": {
            "enabled": "yes",
            "installed_version": "2.3.2",
            "types": "filesystem"
        },
        "backgroundjob": {
            "lastjob": "15"
        },
        "calendar": {
            "enabled": "no",
            "installed_version": "1.3.3",
            "ocsid": "168707",
            "signed": "true",
            "types": ""
        },
        "checksum": {
            "enabled": "yes",
            "installed_version": "2.0",
            "types": "filesystem"
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": "logging"
        },
        "contacts": {
            "enabled": "yes",
            "installed_version": "1.4.0.0",
            "ocsid": "168708",
            "types": ""
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "installedat": "1472499803.6001",
            "lastcron": "1474230602",
            "lastupdateResult": "[]",
            "lastupdatedat": "1474165807",
            "oc.integritycheck.checker": "[]",
            "public_documents": "documents\/public.php",
            "public_files": "files_sharing\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "shareapi_allow_public_upload": "no",
            "shareapi_allow_resharing": "yes",
            "shareapi_default_expire_date": "yes",
            "shareapi_enforce_expire_date": "no",
            "umgmt_send_email": "false",
            "umgmt_show_backend": "true",
            "umgmt_show_email": "false",
            "umgmt_show_last_login": "true",
            "umgmt_show_storage_location": "true"
        },
        "dav": {
            "enabled": "yes",
            "installed_version": "0.2.5",
            "types": "filesystem"
        },
        "documents": {
            "converter": "local",
            "enabled": "yes",
            "installed_version": "0.13.1",
            "ocsid": "168711",
            "types": ""
        },
        "external": {
            "enabled": "yes",
            "installed_version": "",
            "ocsid": "166046",
            "sites": "[[\"Torrents\",\"https:\\\/\\\/my.domain.org\\\/transmission\",\"\"],[\"Portal\",\"https:\\\/\\\/my.domain.org\",\"\"]]",
            "types": ""
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": ""
        },
        "federation": {
            "enabled": "no",
            "installed_version": "0.1.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "1.5.1",
            "types": "filesystem"
        },
        "files_external": {
            "allow_user_mounting": "yes",
            "enabled": "yes",
            "installed_version": "0.6.0",
            "ocsid": "166048",
            "types": "filesystem",
            "user_mounting_backends": "ftp,dav,owncloud,sftp,amazons3,dropbox,googledrive,swift,smb,\\OC\\Files\\Storage\\SFTP_Key,\\OC\\Files\\Storage\\SMB_OC"
        },
        "files_mv": {
            "enabled": "no",
            "installed_version": "0.8.2",
            "ocsid": "150271",
            "types": "filesystem"
        },
        "files_pdfviewer": {
            "enabled": "yes",
            "installed_version": "0.8.1",
            "ocsid": "166049",
            "types": ""
        },
        "files_sharing": {
            "enabled": "yes",
            "installed_version": "0.10.0",
            "types": "filesystem"
        },
        "files_texteditor": {
            "enabled": "yes",
            "installed_version": "2.1",
            "ocsid": "166051",
            "types": ""
        },
        "files_trashbin": {
            "enabled": "yes",
            "installed_version": "0.9.0",
            "types": "filesystem"
        },
        "files_versions": {
            "enabled": "no",
            "installed_version": "1.3.0",
            "types": "filesystem"
        },
        "files_videoplayer": {
            "enabled": "yes",
            "installed_version": "0.9.8",
            "types": ""
        },
        "firstrunwizard": {
            "enabled": "yes",
            "installed_version": "1.1",
            "ocsid": "166055",
            "types": ""
        },
        "gallery": {
            "enabled": "no",
            "installed_version": "15.0.0",
            "types": ""
        },
        "galleryplus": {
            "enabled": "yes",
            "installed_version": "15.1.1",
            "ocsid": "169116",
            "types": ""
        },
        "notifications": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": "logging"
        },
        "ownbackup": {
            "enabled": "yes",
            "installed_version": "0.3.8",
            "ocsid": "170674",
            "types": ""
        },
        "ownnote": {
            "enabled": "no",
            "folder": "",
            "installed_version": "1.08",
            "ocsid": "168512",
            "types": ""
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "0.5.0",
            "types": "prevent_group_restriction"
        },
        "qownnotesapi": {
            "enabled": "no",
            "installed_version": "0.4.4",
            "ocsid": "173817",
            "signed": "true",
            "types": ""
        },
        "shorten": {
            "enabled": "no",
            "installed_version": "0.0.15",
            "ocsid": "168591",
            "types": "filesystem"
        },
        "systemtags": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": "logging"
        },
        "tasks": {
            "enabled": "yes",
            "installed_version": "0.9.3",
            "ocsid": "164356",
            "signed": "true",
            "types": ""
        },
        "templateeditor": {
            "enabled": "yes",
            "installed_version": "0.1",
            "types": ""
        },
        "updatenotification": {
            "contacts": "1.4.0.0",
            "enabled": "yes",
            "installed_version": "0.2.1",
            "qownnotesapi": "16.09.0",
            "types": ""
        },
        "user_ldap": {
            "cleanUpJobOffset": "0",
            "enabled": "yes",
            "has_memberof_filter_support": "0",
            "home_folder_naming_rule": "",
            "installed_version": "0.9.0",
            "last_jpegPhoto_lookup": "0",
            "ldap_agent_password": "*** REDACTED ***",
            "ldap_attributes_for_group_search": "",
            "ldap_attributes_for_user_search": "",
            "ldap_backup_host": "",
            "ldap_backup_port": "",
            "ldap_base": "cn=users,cn=accounts,dc=mydomain,dc=org\ncn=groups,cn=accounts,dc=mydomain,dc=org",
            "ldap_base_groups": "cn=groups,cn=accounts,dc=mydomain,dc=org",
            "ldap_base_users": "cn=users,cn=accounts,dc=mydomain,dc=org",
            "ldap_cache_ttl": "600",
            "ldap_configuration_active": "1",
            "ldap_display_name": "displayName",
            "ldap_dn": "uid=daedalus.cloud.auth.svc,cn=users,cn=accounts,dc=mydomain,dc=org",
            "ldap_dynamic_group_member_url": "",
            "ldap_email_attr": "mail",
            "ldap_experienced_admin": "1",
            "ldap_expert_username_attr": "uid",
            "ldap_expert_uuid_group_attr": "ipaUniqueID",
            "ldap_expert_uuid_user_attr": "ipaUniqueID",
            "ldap_group_display_name": "cn",
            "ldap_group_filter": "(objectClass=groupOfNames)",
            "ldap_group_filter_mode": "0",
            "ldap_group_member_assoc_attribute": "member",
            "ldap_groupfilter_groups": "",
            "ldap_groupfilter_objectclass": "",
            "ldap_host": "ldaps:\/\/my.domain.org",
            "ldap_login_filter": "(&(objectClass=posixAccount)(uid=%uid))",
            "ldap_login_filter_mode": "0",
            "ldap_loginfilter_attributes": "",
            "ldap_loginfilter_email": "0",
            "ldap_loginfilter_username": "1",
            "ldap_nested_groups": "0",
            "ldap_override_main_server": "",
            "ldap_paging_size": "500",
            "ldap_port": "636",
            "ldap_quota_attr": "",
            "ldap_quota_def": "",
            "ldap_tls": "0",
            "ldap_turn_off_cert_check": "0",
            "ldap_user_display_name_2": "",
            "ldap_user_filter_mode": "0",
            "ldap_userfilter_groups": "",
            "ldap_userfilter_objectclass": "",
            "ldap_userlist_filter": "(&(objectClass=posixAccount)(memberOf=cn=cloud-users,cn=groups,cn=accounts,dc=mydomain,dc=org))",
            "types": "authentication",
            "use_memberof_to_detect_membership": "1"
        }
    }
}```

**Are you using external storage, if yes which one:** local/smb/sftp/...
Local

**Are you using encryption:** yes/no
No

**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/...
LDAP

### Client configuration
**Browser:**
Chrome

**Operating system:**
Mac OS 10.11.6

** Logs **
Nothing of note.
@PVince81
Collaborator

Confirmed happening on master / prealpha 9.2.

I suspect a bug in the extension-cutting code. It is likely thinking that ".hidden" is the file extension so doesn't properly map the mime type.

@PVince81 PVince81 added this to the 9.1.2 milestone Sep 19, 2016
@PVince81
Collaborator

Hah, it's even more subtle than that. It only fails if the first char of the path is a "." because strpos($path, '.') evaluates to 0 which in PHP is also false...

PR will follow soon

@PVince81 PVince81 referenced this issue Sep 19, 2016
Merged

Fix mimetype detection inside hidden folders #26138

5 of 9 tasks complete
@PVince81
Collaborator

Fix is here #26138

@PVince81
Collaborator

Potential regression from before 8.2

@ikogan
ikogan commented Sep 24, 2016

Seems to work, thanks!

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