From c04074692e1e97c5f249ec73e46b5ecd80ad19be Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <GapczynskiM@gmail.com>
Date: Tue, 15 May 2012 19:05:07 -0400
Subject: [PATCH] Fix incorrect toaddress being passed for emailing private
 links

---
 apps/files_sharing/js/share.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index ac1209956d6..a1fa3bb4586 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -200,13 +200,13 @@ OC.Share={
 		$('#emailButton').hide();
 	},
 	emailPrivateLink:function() {
+		var link = $('#privateLinkText').val();
+		var file = link.substr(link.lastIndexOf('/') + 1).replace(/%20/g, ' ');
+		$.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: $('#email').val(), link: link, file: file } );
 		$('#email').css('font-weight', 'bold');
 		$('#email').animate({ fontWeight: 'normal' }, 2000, function() {
 			$(this).val('');
 		}).val('Email sent');
-		var link = $('#privateLinkText').val();
-		var file = link.substr(link.lastIndexOf('/') + 1).replace(/%20/g, ' ');
-		$.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: $('#email').val(), link: link, file: file } );
 	},
 	dirname:function(path) {
 		return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
-- 
GitLab