From 06fcef3f4f0191152c83935e1fcff1c098525602 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 6 Jan 2011 13:12:19 -0400 Subject: [PATCH] ISLANDORA-153When uploading a file with an & in it ... ingest breaks --- plugins/FormBuilder.inc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index dbedda75..4fd3fa7d 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -179,7 +179,14 @@ class FormBuilder { if (!empty( $file)) { $dformat = $mimetype->getType($file); - $fileUrl = $base_url . '/'. drupal_urlencode($file); + + $parts = explode('/', $file); + foreach ($parts as $n => $part) { + $parts[$n] = rawurlencode($part); + } + $path = implode('/', $parts); + $fileUrl = $base_url . '/' . $path; + $beginIndex = strrpos($fileUrl, '/'); $dtitle = substr($fileUrl, $beginIndex + 1); $dtitle = urldecode($dtitle); @@ -214,8 +221,13 @@ class FormBuilder { } $dformat = $mimetype->getType($createdFile); - $fileUrl = $base_url . '/'. drupal_urlencode($createdFile); - + $parts = explode('/', $createdFile); + foreach ($parts as $n => $part) { + $parts[$n] = rawurlencode($part); + } + $path = implode('/', $parts); + $fileUrl = $base_url . '/' . $path; + $beginIndex = strrpos($fileUrl, '/'); $dtitle = substr($fileUrl, $beginIndex + 1); $dtitle = urldecode($dtitle);