GetDKAN / dkan

DKAN Open Data Portal
https://dkan.readthedocs.io/en/latest/index.html
GNU General Public License v2.0
365 stars 170 forks source link

Undefined offset warning notice #1047

Closed sheldonrampton closed 7 years ago

sheldonrampton commented 8 years ago

Description

When adding a "Link to a file" resource to a dataset, you may encounter a PHP warning notice that says, "Notice: Undefined offset: 1 in file_entity_file_get_mimetype_type() (line 2465 of sites/all/modules/contrib/file_entity/file_entity.module".

This error only occurs when adding a resource for the first time to the website. If the resource has been added previously, the warning notice does not appear.

This has been documented in DKAN 7.x-1.11.

Steps to Reproduce

CIVIC-2068

sheldonrampton commented 8 years ago

These notices are happening because the file_entity_file_get_mimetype_type() function in the file_entity module tries to explode a string which it expects to contain a slash, such as "application/pdf", but the string passed to the function is something such as "pdf" without a slash. I've filed a bug report and a patch that fixes the PHP notices on Drupal.org:

https://www.drupal.org/node/2700235

I don't know if this is the best way to fix this issue. It would be better if whatever is passing the string into the file_entity_file_get_mimetype_type function passed in a better mimetype string.

janette commented 7 years ago

Issue resolved: https://github.com/NuCivic/dkan_dataset/pull/230 https://github.com/NuCivic/dkan_datastore/pull/65