Comments

divesh.kumar’s picture

I'll take on this.

divesh.kumar’s picture

David,

Can you please put on a bit light what exactly needs to be done as I checked the references in the file.module and its looking fine.

Thanks

thedavidmeister’s picture

This is what I get when I search for check_plain() in the file module using Sublime Text. There are quite a few calls to check_plain() still.

/Applications/MAMP/htdocs/d8/core/modules/file/file.field.inc:
  197    }
  198    if (isset($upload_validators['file_validate_extensions'])) {
  199:     $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => check_plain($upload_validators['file_validate_extensions'][0])));
  200    }
  201  

/Applications/MAMP/htdocs/d8/core/modules/file/file.module:
 1019          // Essential file data
 1020          case 'name':
 1021:           $replacements[$original] = $sanitize ? check_plain($file->getFilename()) : $file->getFilename();
 1022            break;
 1023  
 1024          case 'path':
 1025:           $replacements[$original] = $sanitize ? check_plain($file->getFileUri()) : $file->getFileUri();
 1026            break;
 1027  
 1028          case 'mime':
 1029:           $replacements[$original] = $sanitize ? check_plain($file->getMimeType()) : $file->getMimeType();
 1030            break;
 1031  
 ....
 1035  
 1036          case 'url':
 1037:           $replacements[$original] = $sanitize ? check_plain(file_create_url($file->getFileUri())) : file_create_url($file->getFileUri());
 1038            break;
 1039  
 ....
 1049          case 'owner':
 1050            $name = $file->getOwner()->label();
 1051:           $replacements[$original] = $sanitize ? check_plain($name) : $name;
 1052            break;
 1053        }
 ....
 1597    else {
 1598      $link_text = $variables['description'];
 1599:     $options['attributes']['title'] = check_plain($file->getFilename());
 1600    }
 1601  
 ....
 1625    $icon_directory = $variables['icon_directory'];
 1626  
 1627:   $mime = check_plain($file->getMimeType());
 1628    $icon_url = file_icon_url($file, $icon_directory);
 1629    return '<img class="file-icon" alt="" title="' . $mime . '" src="' . $icon_url . '" />';

/Applications/MAMP/htdocs/d8/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php:
   89      }
   90  
   91:     $title = check_plain($this->fieldDefinition->getLabel());
   92      $description = field_filter_xss($this->fieldDefinition->getDescription());
   93  

/Applications/MAMP/htdocs/d8/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php:
   49      $tests = array();
   50      $tests['[file:fid]'] = $file->id();
   51:     $tests['[file:name]'] = check_plain($file->getFilename());
   52:     $tests['[file:path]'] = check_plain($file->getFileUri());
   53:     $tests['[file:mime]'] = check_plain($file->getMimeType());
   54      $tests['[file:size]'] = format_size($file->getSize());
   55:     $tests['[file:url]'] = check_plain(file_create_url($file->getFileUri()));
   56      $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->id);
   57      $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id);
   58      $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
   59      $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
   60:     $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
   61      $tests['[file:owner:uid]'] = $file->getOwnerId();
   62  
divesh.kumar’s picture

Status: Active » Needs review
StatusFileSize
new3.66 KB

Patch attached.

divesh.kumar’s picture

Assigned: Unassigned » divesh.kumar
thedavidmeister’s picture

Issue tags: +Novice, +@deprecated
thedavidmeister’s picture

Status: Needs review » Needs work

please use namespace aliases, see the parent issue for more details.

divesh.kumar’s picture

I am making changes to all patches I submitted
.

divesh.kumar’s picture

Status: Needs work » Needs review
StatusFileSize
new7.31 KB
thedavidmeister’s picture

Status: Needs review » Needs work
-    $filename = drupal_dirname($test_file->getFileUri()) . '/текстовый файл.txt';
+    $filename = drupal_dirname($test_file->getFileUri()) . '/тек�товый файл.txt';
     $test_file = file_copy($test_file, $filename);

Why are we touching this?

divesh.kumar’s picture

This may be file encoding error. Let me check it.

thedavidmeister’s picture

Assigned: divesh.kumar » Unassigned
divesh.kumar’s picture

Status: Needs work » Needs review
StatusFileSize
new6.82 KB
ianthomas_uk’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good, applies and catches all uses of check_plain() in the file module.

@divesh.kumar, for future reference the convention is that the second number in a patch filename is the comment number that it would be uploaded to, in this case that would make the filename 2196841-13.patch.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

2196841-3.patch no longer applies.

error: patch failed: core/modules/file/file.field.inc:6
error: core/modules/file/file.field.inc: patch does not apply

longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new6.82 KB

Rerolled.

ianthomas_uk’s picture

Status: Needs review » Reviewed & tested by the community

Just changed context

thedavidmeister’s picture

Issue tags: +Quick fix
webchick’s picture

Status: Reviewed & tested by the community » Needs work

Please, no. Can we have just one patch that converts all of these in one go?

thedavidmeister’s picture

Status: Needs work » Postponed
ianthomas_uk’s picture

Status: Postponed » Closed (duplicate)

This was fixed on the meta