[Pkg-owncloud-commits] [owncloud] 01/79: Fix preview of old file on public upload conflicts

David Prévot taffit at moszumanska.debian.org
Tue Sep 1 20:55:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 897e99ac588c6a19b280f2b948c75643786c41af
Author: Olivier Paroz <github at oparoz.com>
Date:   Mon Jul 20 16:51:28 2015 +0200

    Fix preview of old file on public upload conflicts
---
 apps/files_sharing/js/public.js | 24 +++++++++++++-----------
 core/js/oc-dialogs.js           |  4 ++--
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 5923e42..72e2005 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -158,9 +158,18 @@ OCA.Sharing.PublicApp = {
 			};
 
 			this.fileList.generatePreviewUrl = function (urlSpec) {
+				urlSpec = urlSpec || {};
+				if (!urlSpec.x) {
+					urlSpec.x = 36;
+				}
+				if (!urlSpec.y) {
+					urlSpec.y = 36;
+				}
+				urlSpec.x *= window.devicePixelRatio;
+				urlSpec.y *= window.devicePixelRatio;
+				urlSpec.x = Math.floor(urlSpec.x);
+				urlSpec.y = Math.floor(urlSpec.y);
 				urlSpec.t = $('#dirToken').val();
-				urlSpec.y = Math.floor(36 * window.devicePixelRatio);
-				urlSpec.x = Math.floor(36 * window.devicePixelRatio);
 				return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec);
 			};
 
@@ -292,15 +301,8 @@ $(document).ready(function () {
 
 	if (window.Files) {
 		// HACK: for oc-dialogs previews that depends on Files:
-		Files.lazyLoadPreview = function (path, mime, ready, width, height, etag) {
-			return App.fileList.lazyLoadPreview({
-				path: path,
-				mime: mime,
-				callback: ready,
-				width: width,
-				height: height,
-				etag: etag
-			});
+		Files.generatePreviewUrl = function (urlSpec) {
+			return App.fileList.generatePreviewUrl(urlSpec);
 		};
 	}
 });
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 9f88c26..6b915c6 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -388,9 +388,9 @@ var OCdialogs = {
 				c:		original.etag,
 				forceIcon:	0
 			};
-			var previewpath = OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
+			var previewpath = Files.generatePreviewUrl(urlSpec);
 			// Escaping single quotes
-			previewpath = previewpath.replace(/'/g, "%27")
+			previewpath = previewpath.replace(/'/g, "%27");
 			$originalDiv.find('.icon').css({"background-image":   "url('" + previewpath + "')"});
 			getCroppedPreview(replacement).then(
 				function(path){

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list