diff --git a/modules/system/system.install b/modules/system/system.install
index 18a0a67..c030000 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2795,7 +2795,7 @@ function system_update_7061(&$sandbox) {
       foreach ($revision['file'][LANGUAGE_NONE] as $delta => $file) {
         // We will convert filepaths to uri using the default scheme
         // and stripping off the existing file directory path.
-        $file['uri'] = $scheme . preg_replace('!^' . $basename . '!', '', $file['filepath']);
+        $file['uri'] = $scheme . preg_replace('!^' . preg_quote($basename) . '!', '', $file['filepath']);
         $file['uri'] = file_stream_wrapper_uri_normalize($file['uri']);
         unset($file['filepath']);
         // Insert into the file_managed table.
