summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Browning2010-10-26 17:58:39 +0000
committerKyle Browning2010-10-26 17:58:39 +0000
commit6158ec3f6416213ec60fcabd2215c7ab17db039c (patch)
tree96ad099744e6a33cfc64efc8b81937605f51f115
parent1822a1983fc54480e11e35072654cbdc979435e0 (diff)
Commit patch on issue #791210 and #833782
-rw-r--r--services.module6
-rw-r--r--services/file_service/file_service.inc6
2 files changed, 11 insertions, 1 deletions
diff --git a/services.module b/services.module
index ef61bea..adb3e35 100644
--- a/services.module
+++ b/services.module
@@ -675,6 +675,12 @@ function services_get_all($include_resources = TRUE, $reset = FALSE) {
$cache_key = 'services:methods'. ($include_resources?'_with_resources':'');
if (!$reset && ($cache = cache_get($cache_key)) && isset($cache->data)) {
+ // This code is copied from this D7 patch http://drupal.org/node/718636
+ // and is required because under certain caching circumstances, cache_get
+ // does not unserialize the data it returns.
+ if (!is_array($cache->data)) {
+ $cache->data = unserialize($cache->data);
+ }
return $cache->data;
}
else {
diff --git a/services/file_service/file_service.inc b/services/file_service/file_service.inc
index 07a09f1..ba2254e 100644
--- a/services/file_service/file_service.inc
+++ b/services/file_service/file_service.inc
@@ -85,7 +85,11 @@ function file_service_save($file) {
// Update file object as necessary
$file->filepath = file_destination(file_create_path($file->filepath), FILE_EXISTS_RENAME);
- $file->filename = file_munge_filename(trim(basename($file->filepath), '.'), $extensions, TRUE);
+ // If filename has not been specified extract it from filepath.
+ if ((!isset($file->filename)) || (empty($file->filename))) {
+ $file->filename = trim(basename($file->filepath), '.');
+ }
+ $file->filename = file_munge_filename($file->filename, $extensions, TRUE);
$file->filemime = file_get_mimetype($file->filename);
// Rename potentially executable files, to help prevent exploits.