Projet

Général

Profil

Révision e61933c3

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/uuid/uuid_services/uuid_services.module
5 5
 * UUID Services module functions.
6 6
 */
7 7

  
8
/**
9
 * Defines defaults for UUID_SERVICES_ALLOWED_MEDIA_MIMES.
10
 */
11
define('UUID_SERVICES_DEFAULT_ALLOWED_MEDIA_MIMES',
12
'video/brightcove
13
video/youtube'
14
);
15

  
8 16
/**
9 17
 * Implements hook_menu().
10 18
 */
......
147 155
      $entity = (object) $entity;
148 156
    }
149 157
    $entity->uuid_services = TRUE;
158
    // Check that the mime type is whitelisted.
159
    $valid_media_mimes = variable_get('uuid_services_allowed_media_mimes', UUID_SERVICES_DEFAULT_ALLOWED_MEDIA_MIMES);
160

  
150 161
    // Sanitize file user input.
151 162
    if ($entity_type == 'file') {
152
      $entity->filename = _services_file_check_name_extension($entity->filename);
153
      $entity->uri = _services_file_check_destination_uri($entity->uri);
154
      if (!empty($entity->filepath)) {
155
        $entity->filepath = _services_file_check_destination($entity->filepath);
163
      // We have to make sure to whitelist mime types, to avoid the video files
164
      // getting converted into text files, when deployed from one env to other.
165
      if (!in_array($entity->filemime, preg_split('/\r?\n/', $valid_media_mimes))) {
166
        $entity->filename = _services_file_check_name_extension($entity->filename);
167
        $entity->uri = _services_file_check_destination_uri($entity->uri);
168
        if (!empty($entity->filepath)) {
169
          $entity->filepath = _services_file_check_destination($entity->filepath);
170
        }
156 171
      }
157 172
    }
158 173
    entity_uuid_save($entity_type, $entity);

Formats disponibles : Unified diff