The function _patterns_io_file_has_valid_extension() is called twice, we can probably then remove it on the parent function since it is ensured in the inner one:

includes/forms/import.inc - l.360

  // Add the extension if missing or invalid
  if (!_patterns_io_file_has_valid_extension($name)) {
    $name = $name . '.' . $format;
  }

includes/io/io.inc - l.395

  // Check if the file has a valid extension
  // and in case add the format at the end
  if (!_patterns_io_file_has_valid_extension($name)) {
    $name = $name . '.' . $format;
  }

As Stefano suggested we should be careful about this: "Some function calls are a bit entangled, so we must be careful in removing double checkings. Require testings, if you remove it".

I will create a branch of the code at github, take a look to remove it and test if no other functions get affected. I will provide a patch if everything is ok.

Cheers,

David

CommentFileSizeAuthor
#2 issue-1826916.patch1.06 KBdrozas

Comments

drozas’s picture

Status: Needs work » Active
drozas’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new1.06 KB

Hi all,

Please find attached the patch solving the problem. I will also merge and push the changes at git@github.com:QScience/Patterns.git

Regards,

David

drozas’s picture

Status: Patch (to be ported) » Fixed

I'll mark this as fixed, the patch has been included in patterns 7.x-1.0-rc2 release.

drozas’s picture

Status: Fixed » Closed (fixed)